June 28, 2020, 1:17am
I have an enemy entity that I wanna clone lots of times (~100) and set each clone to a different position.
When i change the position of 1 clone all the other clones get the same position, since cloning does not “deep clone” components.
I also have self written scripts on the enemy.
I’m kinda lost, any ideas?
June 28, 2020, 3:38am
Hey! According to clone
documentation, clone() creates deep copy of an entity.
Can you share your code of cloning so that it may get easy to understand the issue?
June 28, 2020, 7:32am
You can see in EnemySpawner that i spawn 3 enemies (clones) but they all land at basically the same position no matter what values i use.
June 28, 2020, 8:12am
We cannot use setPosition function for rigid bodies as it will overrided by physics calculations.
Just add this line
dasher.findComponent('rigidbody').entity.setPosition(posX, 0, posZ);
and it will work fine
June 28, 2020, 8:17am
Thank you SO MUCH! Spent two hours debugging T.T