A* Pathfinding Project

RichAi spawn / despawn


#1

So I am using a spawner to spawn and despawn my agents. The first time they spawn everything is ok and they move correctly.

The second time (when I automatically move them back into position) they just stand completely still and don’t move.

My question is, is there something i should reset when de/respawning agents?


#2

Hey,

Are you using the RichAI Teleport or directly setting the transform position?


#3

i am using the following asset to control the pool:
https://assetstore.unity.com/packages/tools/utilities/pool-kit-the-ultimate-pooling-system-for-unity-121174

which sets the transform position as far as i know


#4

See if you can modify the spawning for the RichAI type to use RichAI.Teleport() instead;

https://arongranberg.com/astar/docs/richai.html#Teleport


#5

will it work if i teleport as soon as they are spawned so the steps are:

  1. Spawn -> Transform position (by the spawner)
  2. i manuelly call teleport to the current transform.position

#6

That might depend on execution order. It might be that if fixed update is called in between it might not work. Shouldn’t be to hard to implement.


#7

Hi

Sorry for the late answer. I am currently traveling and I lost my laptop on a flight, so I haven’t been able to work for a while.

Which version are you using? I think some bugs were fixed in recent versions that had to do with pooling systems. The pooling system must deactivate the GameObject and later activate it again for it to work properly. Otherwise the script will not realize it must reset itself.