void Awake() { if (instance != null && instance != this) { DestroyImmediate(gameObject); return; } instance = this; GameModel.makeScenes(); }
void Awake() { if (instance != null && instance != this) { DestroyImmediate(gameObject); return; } instance = this; GameModel.MakeAreas(); // DontDestroyOnLoad(gameObject); }
public static RunOnlyOnce instance; //creating a static instance of the class RunOnlyOnce void Awake() { if (instance != null && instance != this) { DestroyImmediate(gameObject); //destroy specified gameObject return; } instance = this; GameModel.makeScenes(); //call function from GameModel // DontDestroyOnLoad(gameObject); }