How can I destroy the child of a prefab… I’ve been trying…
Destroy(transform.Find("MainCamera"));
Where main camera is the child of the prefab.
The script is attached to a prefab and the MainCamera is a child of a child of a child of a child of the parent… if that makes sense… so quite deep down the hierarchy.
do i need to specify the hierarchy in any way?
Tarsus.
If i rember right then you have to set the path to the child also.
You also have to remember to detach the child before you destroy it.
any idea of how to do this? Im going round in cirlces trying different things with no luck :-/
I think you want GetComponent not Find. You might also try the following link. I’ve not tried it myself.
http://unity3d.com/support/documentation/ScriptReference/Component.GetComponentInChildren.html