I have a gameObject and attached another empty gameObject to it and I want to move it with code. But how do I select the empty gameObject and store it in some variable so I can set some transform.Translate?
I tried FindGameObjectsWithTag and added a tag to the empty gameObject.
But when I try to call it in a function it says:
Unknown identifier: ‘punchObject’.
here is part of my example code:
`function Start () {
var gos : GameObject[];
gos = GameObject.FindGameObjectsWithTag("punchObject");
var punchObject:GameObject = gos[0];
}
function punchNormal(){
punchObject.transform.Translate(Vector2(10,0));
}`
Is there an easy way to just say I want that object and store it in a variable?