How to cleanup path completely immediatly

i made agent object inherited AIPath.

and the the agent object is used as pooling object.

my polling system have bring method and restore method.

i coded call some methods “path.release(this)”, “seeker.ReleaseClaimedPath()”, “CancelCalcuation…” and something seems to be clear ans clean.

but, when my pool object reuse, occur some errors intermittently.

so, i finally turn off astar path pool and to instantiate and destroy instead of using my pooling system.

however, how to stop use and clean up path completely and immediatly?

Hi

The AIPath.OnDisable and OnEnable methods should work for pooling as many just deactivate and reactivate GameObjects in their pooling systems. Can you perhaps reuse those methods?
(I think they should work fine for pooling systems in the latest version, though there might have been some small improvements in the beta).

In regards to the errors you get, do you make sure to set the ‘path’ field to null after you have called path.release(this) to make sure you don’t use it again?

thank you for answer :slight_smile:

well… i did work already about your suggestions.

when the object reuse and call first the “startPath”.

the almost errors i faced is “already pooled, calculation twice?”, “arguments invalid ‘segment index’” or etc.

why those occur this errors?

Could you post the full script that you are using?