private void Awake() { //if (instance == null && name.ToLower().Contains("prefab") == false) if (instance == null) { //UnityEngine.Debug.Log("Found a GameGO: " + gameObject.name); instance = this; DontDestroyOnLoad(this); } else { UnityEngine.Debug.Log("Found a GameGO: " + name); Destroy(gameObject); return; } }
public static void CreateGameGO() { //UnityEngine.Debug.Log("Loading GameGO ..."); GameGO gameGOPrefab = Resources.Load <GameGO>(Folder + "/GameGOPrefab"); if (gameGOPrefab == null) { UnityEngine.Debug.Log("Unable to find: GameGOPrefab"); return; } GameGO.instance = null; GameGO gameGO = GameObject.Instantiate(gameGOPrefab); gameGO.name = "Game-GO"; GameGO.instance = gameGO; UnityEngine.Debug.Log(gameGO.name + " was created"); //GameObject.Destroy(gameGOPrefab); }
private void Awake() { GameGO.Check(); }