using Eflatun.SceneReference; using MyCollections.SceneManagement; using System.Collections; using System.Collections.Generic; using UnityEngine; public class SceneLoadTrigger : MonoBehaviour { [SerializeField] private SceneReference sceneToLoad; [SerializeField] private SceneReference sceneToUnload; [SerializeField] private SceneAction sceneAction; private SceneLoader sceneLoader; private void Awake() { } // Start is called before the first frame update void Start() { sceneLoader = SceneLoader.Instance; } private void Update() { } public void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Player") { switch (sceneAction) { case SceneAction.LoadScene: sceneLoader.LoadSceneTrigger(sceneToLoad); break; case SceneAction.UnloadScene: sceneLoader.UnloadSceneTrigger(sceneToUnload, sceneToLoad); break; } } } public void OnEnable() { } public void OnDisable() { } }