void Start() { textForButton = gameObject.GetComponentInChildren <Text> (); pauseControl = GameObject.FindGameObjectWithTag("GameManager").GetComponent <MenuController_Paused> (); thisAudioSource = gameObject.GetComponent <AudioSource> (); thisAudioSource.playOnAwake = false; if (modifyFontSize) { textForButton.fontSize = startingFontSize; } if (modifyFontColor) { textForButton.color = startingTextColor; } }
MenuController_Paused pauseManager; // A reference to the MenuController used for our pause menu void Start() { rb2d = GetComponent <Rigidbody2D> (); // We instantiate the rb2d as a rigidbody attatched to this game object pauseManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <MenuController_Paused> (); // We set the pauseManager as a script found on a GameObject with a tag of "GameManager" }
Canvas myCanvas; // A canvas which defines what the canvas is on the object this script is attached to void Start() { myCanvas = gameObject.GetComponent <Canvas> (); // We set our canvas pauseControl = GameObject.FindGameObjectWithTag("GameManager").GetComponent <MenuController_Paused> (); // We define the pauseControl variable }