How do I Re-parent an entity

Lets say I instantiate a new template to a parent:

this.myEntity.addChild(parent_A);

but then I want to change its parent to parent_B

How do I do that?

If I then do:
this.myEntity.addChild(parent_B);

It just gives an error saying its already parented…

https://developer.playcanvas.com/en/api/pc.Entity.html#reparent

1 Like