Entity: Dis- and enable again by scripting

How do I make an heirarchy-entity invisible, for then to make visible again (by buttons btw)

Just to check, invisible or inactive?

for active/inactive
entity.enabled = false;
entity.enabled = true;

for invisible/visible
entity.model.enabled = false;
entity.model.enabled = true;

toggle function:
if(xx) xx=false;
else xx=true;

ok so you refer to ‘model’ as having the render-option … I have already tried the:
entity.enabled = false;
entity.enabled = true;

  • approach, which fails in the same way as in Unity (the entity sort of gets lost when being disabled (code cannot find it again when ‘gone’))

But will try the render-like option - thx

Unlike Unity, FindByName should return inactive objects.

Here is a quick demo, button on the top right: https://playcanvas.com/editor/scene/641809