- Home /
Destroy gameObject not destroying child
I'm a student and new to scripting and unity. Bombastically my Destroy(zombieToDie.gameObject,5); seems to only be destroying the ZombiePrefab but not the ZombieMeleeWeapon its holding? Shouldn't destroying an object destroy everything inside that object as well I'm a bit confused?
here is a pic of the hierarchy the ZombieMeleeWeapon(clone) is left behind after destroy function in initialized?
Further information needed, can you post the script/sections that detail destroy and what instantiates the ZombiePrefab
Do you work on this with any other coders? It almost seems like there is a script that when a Zombie gets killed he drops his weapon which would detach the Zombie$$anonymous$$eleeWeapon from the parent.
Is this bad? Seems kinda cool that a dead zombie's weapon would be left on the ground.
you are spot on jee but because there wasnt actuallly a weapon it just appeared to be a random cube without mesh on the ground which had me confused :) its the shooter AI pack that uni supplied us with that had this function in the script a simple commenting it out worked a treat
Answer by MorphiusX · May 09, 2014 at 03:05 PM
Hey thanks for the info just to let you know it appears the pack i was using (supplied by uni) has a drop weapon function that was enabled so i just // it out and its all working again