I'm just trying to get acquainted with how buttons control text objects.
Could my two methods (counterUp and counterDown) be combined into one method that responds to both the number up and number down buttons in Unity? (For the sake of only manage one method instead of 2). to If so how?
public class MainScript : MonoBehaviour { int count; public Text numberUpDown; void Start () { StartGame (); } void StartGame() { count = 100; } public void counterUp () { count = count+1; numberUpDown.text = count.ToString (); } public void counterDown () { count = count-1; numberUpDown.text = count.ToString (); } }
↧