# How to use mesh.setEnabled(true) so it affects all children recursively?

**URL:** <https://forum.babylonjs.com/t/how-to-use-mesh-setenabled-true-so-it-affects-all-children-recursively/22219>\
**Category:** Questions\
**Created:** [July 7, 2021, 12:15pm UTC](https://forum.babylonjs.com/t/how-to-use-mesh-setenabled-true-so-it-affects-all-children-recursively/22219 "2021-07-07T12:15:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrik](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/patrik/32/16721_2.png) [@Patrik](https://forum.babylonjs.com/u/Patrik)\
**Post date:** [July 7, 2021, 12:15pm UTC](https://forum.babylonjs.com/t/how-to-use-mesh-setenabled-true-so-it-affects-all-children-recursively/22219/1 "2021-07-07T12:15:41Z")

</div>

Hello again,  
I have multiple models in _.babylon_ file exported from Blender which are loaded on background with setEnabled(false) property. If I need to add one of them to my scene, I create instance or clone and apply setEnabled(true) on to that instance/clone. The “model library” contains also some root meshes with children. But when I try to **create clone** of this disabled root mesh and call _clonedRootMesh.setEnabled(true),_ only root mesh is visible (but not pickable, what also kind of irritates me). I can see via inspector that all children of root mesh are cloned also but disabled.

I searched forum for this and based on [this](https://forum.babylonjs.com/t/parent-node-visibility-not-affect-child-node/7952) and [this](https://forum.babylonjs.com/t/why-createinstance-doesnt-affect-children-but-clone-does/1481) topics I believe that _rootMesh.setEnabled(true)_ should also affect children. So is this bug or am I missing something? Do I need to loop over all children and set them enabled and pickable manually? 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 7, 2021, 3:08pm UTC](https://forum.babylonjs.com/t/how-to-use-mesh-setenabled-true-so-it-affects-all-children-recursively/22219/2 "2021-07-07T15:08:38Z")

</div>

> [@Patrik](#):
>
> I believe that _rootMesh.setEnabled(true)_ should also affect children

This is not true :). setEnabled is not recursive for performance reasons.

To achieve your goal you have multiple options:

- simply call setEnabled(false) on the root. That will block the rendering of the meshes and its children: [Babylon.js Playground (babylonjs-playground.com)](https://www.babylonjs-playground.com/#8GDR8M)
- Use assetContainers which are meant to be storage space for meshes outside of the rendering list: [Asset Containers | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/divingDeeper/importers/assetContainers)
- Use getChildMeshes: `root.getChildMeshes(false, c => c.setEnabled(true));`

---

<div class="post-metadata">

**Author:** ![Nove\_K](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nove_k/32/24832_2.png) [@Nove\_K](https://forum.babylonjs.com/u/Nove_K)\
**Post date:** [June 6, 2022, 12:14pm UTC](https://forum.babylonjs.com/t/how-to-use-mesh-setenabled-true-so-it-affects-all-children-recursively/22219/3 "2022-06-06T12:14:35Z")

</div>

I hope it’s clear in the document. Otherwise it’s really confusing
