Support Forum

Searching for a path on a different thread

Is there any way to search for a path when on a different thread? I’ve an AI thread and I’ve tried calling this:

AstarPath.StartPath()

But it throws this error:

UnityException: get_isPlaying can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.