Currently I use `NavMesh.CalculatePath` to find a path for an entity. The problem is that calling this function synchronously from `Update` causes the game to freeze temporarily when there are many entities finding their paths at once or when the paths are difficult to find.
I was thinking about moving the path-finding to a separate thread, but as far as I know Unity classes are not thread-safe. Therefore calling `NavMesh.CalculatePath` from another thread does not seem to be an option. Or is it possible to call it from a single thread, but not the main thread? I was thinking about a work queue for finding paths.
Are there any other options to find paths asynchronously?
↧