First off, my apologies for the spammage on small questions like this this evening. =/ This one’s really short: Is it possible for an object to find out who or what instantiated it? I.e.: When Player instantiates a Rocket, could I have the Rocket send back a message to the Player object? (GameObject.Find is of no help here as there are multiple Player objects and I don’t want to iterate through all of them.)
This is fairly simple. In the same procedure where you call Instantiate(), set the GameObject’s transform.parent property equal to the creator. That’s not only useful for sending back messages, but also for debugging a scene, as it keeps the objects in good order in the Hierarchical pane.
If that option doesn’t work for you, create a new member variable, and store it there instead. Either way, the key point is to catch the return value of Instantiate so you can modify the object immediately afterwards.
D’ow, should’ve thought of setting a variable after the instantiation myself, sorry. x.x (I blame the time.) I really like the idea of setting the player as it’s parent as well though! Definitely something I’ll try, thanks! =D