protected virtual void Awake() { // Only one instance of SaveMenu may exist if (instance != null) { Destroy(gameObject); return; } instance = this; GameObject.DontDestroyOnLoad(this); clickAudioSource = GetComponent <AudioSource>(); }
protected virtual void Awake() { // Only one instance of SaveMenu may exist if (instance != null) { Destroy(gameObject); return; } instance = this; GameObject.DontDestroyOnLoad(this); clickAudioSource = GetComponent<AudioSource>(); }
protected virtual void Awake() { // Only one instance of SaveMenu may exist if (instance != null) { Destroy(gameObject); return; } instance = this; if (transform.parent == null) { GameObject.DontDestroyOnLoad(this); } else { Debug.LogError("Save Menu cannot be preserved across scene loads if it is a child of another GameObject."); } clickAudioSource = GetComponent <AudioSource>(); }
//public string key; // Use this for initialization void Start() { //save = GameObject.Find("/DontDestroyOnLoad/SaveMenu"); saveMenu = gameObject.GetComponent <SaveMenu>(); }