[SOLVED] Error when setting a new cloned entity as a child of root by Entity.addChild

Hi all,

I just tried cloning an entity and set the new one as a child of the root in the scene pragmatically, I could see the new cloned entity in the scene, but got an error like,

[launch.js:7503]: Maximum call stack size exceeded

Here is my code,

    var e = this.entity.clone();
    e.setPosition(1, 1, 1);```

Can anyone plz give me some tips?

Try moving the script that does the cloning to a different entity than the one that is cloned. You are probably cloning the clone.

Ta… The entity with my stupid code just keeps cloning itself over and over again… That’s why I got the error