public void funLoadLevelState(ILevelState lvl) { GameObject.DontDestroyOnLoad((RefLevel as MonoBehaviour).gameObject); SceneManager.LoadScene(2); // TODO: Check game scene number RefLevel = lvl; RefLevel.funDayStart(); }
private void Start() { DontDestroyOnLoad(gameObject); if (RefLevel == null) { RefLevel = new GameObject("LevelState").AddComponent <Level1>(); DontDestroyOnLoad((RefLevel as MonoBehaviour).gameObject); } RefLevel.funDayStart(); }