void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); return; } _instance = this; CardGame.Invalid.CoroutineRunner = this; DontDestroyOnLoad(gameObject); if (!Directory.Exists(CardGame.GamesDirectoryPath)) { CreateDefaultCardGames(); } LookupCardGames(); CardGame currentGame; Current = AllCardGames.TryGetValue(PlayerPrefs.GetString(PlayerPrefGameName), out currentGame) ? currentGame : AllCardGames.First().Value; if (Debug.isDebugBuild) { Application.logMessageReceived += ShowLogToUser; } SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; }
void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); return; } _instance = this; CardGame.Invalid.CoroutineRunner = this; DontDestroyOnLoad(gameObject); if (!Directory.Exists(CardGame.GamesDirectoryPath)) { CreateDefaultCardGames(); } LookupCardGames(); if (Debug.isDebugBuild) { Application.logMessageReceived += ShowLogToUser; } SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; ResetCurrentToDefault(); }