- Home /
GUI Label, No appropriate version of 'UnityEngine.GUI.Label'
Hello, When I run my code, I receive this error: No appropriate version of 'UnityEngine.GUI.Label' for the argument list '(UnityEngine.Rect, int)' was found.
This is my code:
var totalPillar : GameObject[];
var totalFoundations : GameObject[];
function Start () {
}
function Update () {
}
function OnGUI (){
totalPillar = GameObject.FindGameObjectsWithTag("Pillar");
totalFoundations = GameObject.FindGameObjectsWithTag("Foundation");
print(totalPillar.Length*2 + totalFoundations.Length*8 - 10);
GUI.Label(Rect(10,40,100,100),totalPillar.Length * 2 + totalFoundations.Length * 8 - 10);
}
Comment
Answer by Side · May 28, 2015 at 08:57 PM
The compiler can't recognize a string because you are passing a number to it. Try this:
GUI.Label(Rect(10,40,100,100), ""+(totalPillar.Length * 2 + totalFoundations.Length * 8 - 10));
By adding the number and the empty string, you get the number as a string.