Destroying entity isn't destroying parented entity

Hi guys,

we are cloning an entity (helmet) and parenting it to one bone of our player. When we are destroying the player, the helmet is still rendered even if the entity is destroyed. The helmet is no more in the hierarchy and the entity of the helmet is null. The destroy function is also invoked on components of the helmet entity.

Are we forgetting something after parenting the helmet to the bone and destroying his root?
Thank you,

So I guess you do something like this to set up the helmet:

this.helmet = helmetTemplate.clone();
var bone = this.entity.findByName('SomeBone');

(where helmetTemplate is the original helmet entity)

To destroy, you’d do:

var bone = this.entity.findByName('SomeBone');

I’m not actually sure you need to remove the child first. But I guess it doesn’t hurt. :wink:

To destroy, I’m only destroying the root entity (the player) of the helmet. What I was saying is that I was verifying that the destroy was called on the helmet by putting a component with a destroy: function() { console.log('destroying'); in it. I also verified that the helmet entity was no more in the hierarchy by console.log all the children of the scene root. But the helmet is still rendered even if the helmet entity is destroyed (his root entity is destroyed in fact).

It sounds like a bug. Would it be possible for you to create a simple project showing the problem and add me in your team? My username is vaios.

I’ll do this next week :smile: weekend time!