LoginSignup
15
11

More than 5 years have passed since last update.

Unityで *** can only be called on an active agent that has been placed on a NavMesh.とか言われる時の対処法

Posted at

ナビメッシュで経路探索するときに、
オブジェクトを消したり出したりしていると、
時々出てくるのが、

"hogehoge" can only be called on an active agent that has been placed on a NavMesh.

というエラー。
ナビメッシュ上にオブジェクトがないときとか、
準備が整う前?にResume とか SetDestination とかしようとすると発生する模様。

ナビメッシュ上にオブジェクトが存在し、経路探索可能な状態かどうか調べるには、

if(navMeshAgent.pathStatus != NavMeshPathStatus.PathInvalid) {
//navMeshAgentの操作
}

とすると良いみたい。

15
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
11