Function AstarPath.OnDisable
OnDisable
()
Cleans up graphs to avoid memory leaks.
Private
void OnDisable ()
Cleans up graphs to avoid memory leaks.
This is called by Unity when:
The component is explicitly disabled in play mode or editor mode.
When the component is about to be destroyed
Including when the game stops
When an undo/redo event takes place (Unity will first disable the component and then enable it again).
During edit and play mode this method should:
Destroy all node data (but not the graphs themselves)
Dispose all unmanaged data
Shutdown pathfinding threads if they are running (any pending path requests are left in the queue)