I’m using IAstarAI and I’ve got some issue with the Teleport function. It seems to be very hit & miss, sometimes it works fine and other times it doesn’t.
I’ve got my AI being pooled at the start of the game & are initialized at Vector3.zero & then disabled.
I then spawn them where I want, later on, to do this I spawn them from the pool & then use Teleport to move them. This generally works, but for some reason, some AI will just no teleport, even though when i debug log them, the location being sent to Teleport is correct.
When they are spawned from the pool I’m setting the values as seen below;
this.agent.canMove = true; this.agent.canSearch = true; this.agent.isStopped = true;
Then the teleport code is:
this.agent.canSearch = true; this.Destination = origin; this.agent.destination = origin; this.agent.Teleport(origin);
If I spawn 100 AI, with a small delay in between spawning, most of them will spawn fine, but there is always some who don’t teleport…
Should I be setting some other value just before teleporting them?
Thanks for any help!