[SOLVED] Hide entity and all of it's children, without using ENABLED


We have a scene with 2 different seats in it. These seats have different tweens and animations. They are parented to a scene entity for easier moving, etc.

We want to be able to hide their parent entity, and with it all of it’s children, without using the .enabled part. If we use the .enabled variable, they appear and disappear correctly, but calling a PlayAnim() on both of them only runs on the enabled ones, - as expected.

These entity collections have various nested entites, so going through them with looping their children would result in tons of loops.

Any ideas how to hide a parent entity and all of it’s children without disabling them?

Hi @at_3DigitStudio,

If by hide you mean stop rendering them you can do so on their model component:

// find all model components under an entity
const models = parentEntity.findComponents('model');

// include the model of the parent entity, if available
if( parentEntity.model) models.push(parentEntity.model);

// hide all models (remove from renderer)
models.forEach( model => model.hide() ); 

// to show them just use show()


1 Like

Hi @Leonidas!

Thank you for the shorthand of all model lookup, it’s really a saver!

1 Like