Here’s a part of the code I’m having trouble with. I want to update 3D text in the scene from a js attached to another object in the same scene.
the 3D text object is called “LEDCredits”
I’m converting an int to a string, then assigning that string to the TextMesh.
I know it’s converting to a string properly, but I can’t figure out what I’ve done wrong to get this error.
However, I keep getting a ‘text’ is not a member of UnityEngine.Component error.
I got this code from http://forum.unity3d.com/viewtopic.php?t=26474
Any help would really be appreciated.
Thanks!
var newtext: String;
var amount: int;
amount = InV.credit[InV.sm];
newtext = amount.ToString();
print("game credit = " + newtext);
var abc = GameObject.Find("LEDCredits");
abc.GetComponent(TextMesh).text = newtext;