Answers for "text variable type unity"

C#
1

text variable type unity

using UnityEngine;
using UnityEngine.UI; //make sure to add this!

public class Script : MonoBehaviour
{
	public int counter = 0;
	public Text variable; //make reference in Unity Inspector Window
    
    void Update()
    {
    	counter++;
    	variable.text = "counter: " + counter;
    }
}
Posted by: Guest on June-27-2020

C# Answers by Framework

Browse Popular Code Answers by Language