Hi, I wrote this script to destroy a GUI Text field when the right mouse button is clicked and it WORKS but it’s also telling me “Unity Exception. You are not allowed to call this function when declaring a variable. Move it to the line after with a variable declaration.”
And here’s my code:
var them = gameObject;
function Update () {
if (Input.GetButton(“Fire2”))
Destroy (them);
}
I don’t see a problem here, but i’m sure there is one. Any thoughts?