Beginner B14 – GUI Text and Counters
How to display information onscreen with GUI Text components and display a counting variable. Code Used (Javascript) var Counter : int = 0; function Update () { Counter++; guiText.text = "Counter...
View ArticleBeginner B26 – Using Mathf.Clamp to restrict values
Using Mathf.Clamp function to restrict values in your game mechanics to within a specified range. Code Used (Javascript) function Update () { var xMove : float = Input.GetAxis("Horizontal") *...
View ArticleBeginner B27 – Using Time.timeScale to Pause
How to Pause the game by implementing Time.timeScale. Code Used (Javascript) var paused : boolean = false; function Update () { if(Input.GetButtonUp("Jump")){ if(!paused){ Time.timeScale = 0;...
View ArticleBeginner B28 – SendMessage() to Call External Functions
How to use SendMessage() to call functions in scripts attached to other objects. Code Used (Javascript) – Reactor.js var downTexture : Texture2D; function React () { renderer.material.mainTexture =...
View Article