Hello,
I have a game object called MissileLauncher, within that I have a child called Missile. The Missile has a script on it that needs to change a variable in a script attached to the MissileLauncher.
I try to use GetComponent, but I always seem to get a null when getting a component up the hierarchy (on the parent). Is there a way to do this? I've been using all the examples that the Scripting API gives, and I can never do it?!
Okay, here is my layout:
MissileLauncher (Parent), contains variable:
var timeInterval : float = 2;
Missile (Child), needs to talk to 'timeInterval':
getMissileLauncher = gameObject.GetComponent("MissileLauncher");
getMissileLauncher.timeInterval = 5;
Every time I play, I get a null error. Also, I don't want to use statics.
How do I talk upward?? Driving me crazy!
Thanks folks!