void Awake() { if (instance == null) { DontDestroyOnLoad(transform.parent.gameObject); instance = this; } else { DestroyImmediate(transform.parent.gameObject); } }
// Start is called before the first frame update void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public virtual void Awake() { if (_transitionPanel == null) { _transitionPanel = FindObjectOfType <TransitionPanel>(); } if (_accountButton == null) { _accountButton = FindObjectOfType <AccountButton>(); } }
// Start is called before the first frame update void Start() { if (persistentPlayerData == null) { object readData = DataManagement.ReadDataFromFile(); if (readData != null) { persistentPlayerData = (ScenePlayerData)readData; } else { persistentPlayerData = new ScenePlayerData(); persistentPlayerData.SetAllData(0, startPoint, Quaternion.identity); DataManagement.WriteDataToFile(persistentPlayerData); } } player = GameObject.FindGameObjectWithTag("Player").GetComponent <MovScript> (); player.activeControl = true; panel = TransitionPanel.instance; panel.Initialize(); player.GetComponent <PlayerAtributes> ().Initialize(); }