error when trying to display number in text area

so i have this points = GUI.TextArea (Rect (70, 10, 50, 20), points, 10); and static var points: int = 0; in another script i get an error can not convert int to string i know what it means but i dont know how to fix it any help

if your var point:int is the same points=GUI.TextArea...then it surely wont work..just change that var to pointsDisplay or something of the sort. var points:int function Update() { var pointsDisplay = GUI.TextArea (Rect (70, 10, 50, 20), "Points "+points); }

–

1 Answer

1

If you need to convert an int to a string, you could use something like this:

points.ToString();

Remember that TextArea() returns a string, though. You may want to use parseInt() or int.TryParse() if you want to capture that value as a number. Here’s a similar thread about floats.