Skip to content

Instantly share code, notes, and snippets.

@iwashihead
Created February 10, 2017 16:07
Show Gist options
  • Save iwashihead/386388af29c390e69900eb8e5c4b61a1 to your computer and use it in GitHub Desktop.
Save iwashihead/386388af29c390e69900eb8e5c4b61a1 to your computer and use it in GitHub Desktop.
NavMeshAgentの位置しているNavMeshのエリア種類を取得する
using UnityEngine;
public class NavMeshAreaSearch
{
public NavMeshAgent NavMeshAgent;
void Hoge() {
// 現在乗っているNavMeshのエリアをPrintする
NavMeshHit navMeshHit;
if(NavMesh.SamplePosition(NavMeshAgent.transform.position, out navMeshHit, float.MaxValue, NavMesh.AllAreas)) {
print (navMeshHit.mask);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment