I’m trying to (by the most efficient means possible) deparent a weapon object from an enemy on their death. The weapon object is parented to the hand bone, which is obviously down a long list of bone child heirarchies. I tried transform.Find but I couldn’t get results, I’m assuming this is because it will only find immediate child objects, and not go down the whole hierarchy? I also tried BroadcastMessage but it crashed Unity in runtime (so obviously I used that very wrong).
You can just use GetComponentsInChildren, what you search for is up to you, you could just list all transforms and check if one has a certain tag or layer, or you could list all scripts or other components in the hierarchy.