- Instead of
yield
make sure to await the “instantiate” call (it’s async) - Note that
position
is local position in threejs and not world position as in Unity (see docs) - we have utility methods forgetWorldPosition
andsetWorldPosition
that you can use instead
I would refactor the method to run async
onEnable() { this.spawn() }
async spawn() {
while(this.enabled && this.spawned < this.max)
{
await delay(2000); // util method from needle engine
// your other spawn code....
}
}
I completely forgot to say thank you!
by user 697872771497328640
Thank you very much!
by user 697872771497328640
You’re welcome
(Btw as a sidenote I added support to await promises with yield in one of the recent versions after your question )