How would I go about instantiating a gameobject “weapon” not as it’s own objet at the bottom hierarchy, but inside the “hand” object of the “enemy” it’s respawning from?
I hope you understand what I mean. It puzzles me and I’m sure it’s not that hard. 
Hey there, Sollthar.
Check the docs, for the parent property of the transform component.
http://unity3d.com/support/documentation/ScriptReference/Transform-parent.html
Make sure to reposition the weapon after that.
I’m sorry if I’m being daft, but I can’t figure out how to actually code it. 
What I have is this:
An Object called “Enemy” which is the parent of an Object called “Hand”. The script is attached to the “Enemy” object. I’d like to have my weapon Gameobject Instantiate into “Enemy/Hand/” (there are several “Enemy” clones around in the scene, each instantiating their own weapons)
But I get an error saying:
Setting the parent of a transform which resides in a prefab is disabled to prevent dara corruption
The “Enemy” object is a prefab itself, spawning all over the map and then supposedly spawning different weapons into their hands. Which doesn’t seem to work…
You could try the following:
- Instantiate the weapon
- In the Enemy script, do a transform.Find(“Hand”)
- Using the returned transform from the find, use it as the parent of the weapon
If it still fails, dunno what it could be. The enemy is instantiated during runtime, or you
just dropped it on the scenery?
Everything is instantiated on runtime except for the static levelgeometry.
It’s odd. I’ll remain on it.