In my game I am developing I attempted to add a script which would change my 3D text value when triggered. Got 2 errors though... :-(
My Code looks like this:
function OnTriggerEnter( hit: Collider)
{
if(hit.gameObject.tag == "Test")
{
var a=GameObject.Find("New Text");
a.GetComponent(TextMesh).text="a";
}
}
But I got an error that said this:
'text' is not a member of UnityEngine.Component'.
When I tried to bypass this I also recieved another error which said something like this (not exact):
Unity Exception. Variable cannot be declared in this function.
Does this have to do with it being Unity iPhone?
Please help by posting a better piece of code or by explaining what is wrong. Thanks alot! :D