private void Awake() { if (instance != null) { Destroy(this.gameObject); } else { instance = this; saveData = new SaveData(); jsonSaver = new JsonSaver(); } }
private void Awake() { if (_instance != null) { Destroy(gameObject); } else { _instance = this; _saveData = new SaveData(); _jsonSaver = new JsonSaver(); } Object.DontDestroyOnLoad(gameObject); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } saveData = new SaveData(); jsonSaver = new JsonSaver(); }
// initialize SaveData and JsonSaver objects private void Awake() { _saveData = new SaveData(); _jsonSaver = new JsonSaver(); }
/// <summary> /// Instantiates SaveData and JsonSaver classes. /// </summary> public void GetReferences() { _saveData = new SaveData(); _jsonSaver = new JsonSaver(); }