# Transform And Mesh Cloning Child Names

**URL:** <https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723>\
**Category:** Questions\
**Created:** [April 3, 2020, 10:46pm UTC](https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723 "2020-04-03T22:46:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MackeyK24](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mackeyk24/32/3741_2.png) [@MackeyK24](https://forum.babylonjs.com/u/MackeyK24)\
**Post date:** [April 3, 2020, 10:46pm UTC](https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723/1 "2020-04-03T22:46:18Z")

</div>

Yo @Deltakosh … I have a problem where the child nodes of deep cloning **ALWAYS** prefixes the new parent clone name with the child name: **TransformNode.clone** and **Mesh.Constructor**

```auto
if ((<any>child).clone) {
    (<any>child).clone(name + "." + child.name, result);
}

```

This is renaming my whole hierarchy and really messing things up when cloning with children.  
Can we please add some sort of switch or something on the scene (scene.prefixClonedChildNames - default true)

```auto
if (scene.prefixClonedChildNames === true) {
  if ((<any>child).clone) {
    (<any>child).clone(name + "." + child.name, result);
  }
}
else
{
  if ((<any>child).clone) {
    (<any>child).clone(child.name, result);
  }
}

```

That way i can turn that off and have the same name as my clone source children by setting **scene.prefixClonedChildNames = false;**

Please let me know if something like that is kool and i will make a PR 🙂

---

<div class="post-metadata">

**Author:** ![PichouPichou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pichoupichou/32/316_2.png) [@PichouPichou](https://forum.babylonjs.com/u/PichouPichou)\
**Post date:** [June 25, 2021, 2:25pm UTC](https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723/2 "2021-06-25T14:25:31Z")

</div>

I am having the same issue. We use the mesh name in our UI and we end up with duplicated string in the mesh name after cloning.

Maybe adding a new argument in the clone method would better than setting a scene property?  
Willing to make a PR if needed too 😉

---

<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:** [June 25, 2021, 3:01pm UTC](https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723/3 "2021-06-25T15:01:04Z")

</div>

Please feel free to make a PR for it, and the best might be to pass in a custom function to generate the name which defaults to our current behavior so anybody can rename as they prefer.

---

<div class="post-metadata">

**Author:** ![Hashiinngg](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/hashiinngg/32/32912_2.png) [@Hashiinngg](https://forum.babylonjs.com/u/Hashiinngg)\
**Post date:** [July 22, 2023, 7:19pm UTC](https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723/4 "2023-07-22T19:19:31Z")

</div>

I am also facing this issue, is there any progress on this matter? TIA.

---

<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:** [July 24, 2023, 4:12pm UTC](https://forum.babylonjs.com/t/transform-and-mesh-cloning-child-names/9723/5 "2023-07-24T16:12:33Z")

</div>

This has not been tackled but do you want to make a PR @Hashiinngg ?

A custom naming function would be cool here 🙂
