void Awake() { continueButton = dialoguePanel.transform.Find("Continue").GetComponent <Button> (); dialogueText = dialoguePanel.transform.Find("Text").GetComponent <Text> (); nameText = dialoguePanel.transform.Find("Name").GetChild(0).GetComponent <Text> (); continueButton.onClick.AddListener(delegate { ContinueDialogue(); }); dialoguePanel.SetActive(false); if (Instance != null && Instance != this) { Destroy(gameObject); } else { Instance = this; } }
private AudioManager _audioManager; // TODO: is this ok to have spawn manager in the toolbox? void Awake() { if (_instance != null) { Destroy(this.gameObject); } else { _instance = this; DontDestroyOnLoad(this); } this._gameManager = gameObject.AddComponent <GameManager>(); this._levelManager = gameObject.AddComponent <LevelManager>(); this._playerMan = gameObject.AddComponent <PlayerManager>(); this._dialogueManager = gameObject.AddComponent <DialogueSystemManager>(); this._canvasManager = gameObject.AddComponent <CanvasManager>(); this._audioManager = gameObject.AddComponent <AudioManager>(); }