# How to replace a mesh in the scene by adding another mesh

**URL:** <https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816>\
**Category:** Questions\
**Tags:** tutorial\
**Created:** [January 2, 2020, 3:32pm UTC](https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816 "2020-01-02T15:32:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devraj\_Reddy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devraj_reddy/32/4710_2.png) [@Devraj\_Reddy](https://forum.babylonjs.com/u/Devraj_Reddy)\
**Post date:** [January 2, 2020, 3:32pm UTC](https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816/1 "2020-01-02T15:32:07Z")

</div>

Hi,  
How to replace an existing mesh in the scene by adding another mesh with a button. Like the navigation tab in _“Node material editor”_ in Babylonjs, where we can select different meshes with the help of an icon and replace the previous mesh.

[https://nme.babylonjs.com](https://nme.babylonjs.com)

My project:  
[https://www.babylonjs-playground.com/#XD7UDJ#4](https://www.babylonjs-playground.com/#XD7UDJ#4)

Thank you,  
Devraj

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 2, 2020, 3:39pm UTC](https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816/2 "2020-01-02T15:39:14Z")

</div>

you can use pseudo code like in your click handler:

```auto
var currentParent = currentMesh.parent;
currentMesh.dispose();
var newMesh = ...;
newMesh.parent = currentParent;

```

---

<div class="post-metadata">

**Author:** ![Devraj\_Reddy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devraj_reddy/32/4710_2.png) [@Devraj\_Reddy](https://forum.babylonjs.com/u/Devraj_Reddy)\
**Post date:** [January 2, 2020, 3:54pm UTC](https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816/3 "2020-01-02T15:54:54Z")

</div>

Thank you Sebavan!! Can you please show me in the project?

[https://www.babylonjs-playground.com/#XD7UDJ#4](https://www.babylonjs-playground.com/#XD7UDJ#4)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 2, 2020, 4:07pm UTC](https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816/4 "2020-01-02T16:07:25Z")

</div>

You were just missing the variable declaration:

[https://www.babylonjs-playground.com/#XD7UDJ#9](https://www.babylonjs-playground.com/#XD7UDJ#9)

---

<div class="post-metadata">

**Author:** ![Devraj\_Reddy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/devraj_reddy/32/4710_2.png) [@Devraj\_Reddy](https://forum.babylonjs.com/u/Devraj_Reddy)\
**Post date:** [January 2, 2020, 4:17pm UTC](https://forum.babylonjs.com/t/how-to-replace-a-mesh-in-the-scene-by-adding-another-mesh/7816/5 "2020-01-02T16:17:27Z")

</div>

Thanks a lot!! 😃
