public void OnDisable() { if (instance == this) { instance = null; } }
// Call this once from the game thread public static void CreateObject() { if (instance != null) { return; } if (Application.isPlaying) { // add an invisible game object to the scene GameObject obj = new GameObject("BazaarGames_QueueRunner"); DontDestroyOnLoad(obj); instance = obj.AddComponent <BazaarGamesHelperObject>(); } else { instance = new BazaarGamesHelperObject(); sIsDummy = true; } }