22 lines
357 B
C#
22 lines
357 B
C#
|
using UnityEngine;
|
||
|
using UnityEngine.AI;
|
||
|
|
||
|
public class ShowNavmesh : MonoBehaviour
|
||
|
{
|
||
|
void Start()
|
||
|
{
|
||
|
ShowMesh();
|
||
|
}
|
||
|
|
||
|
void ShowMesh()
|
||
|
{
|
||
|
NavMeshTriangulation meshData = NavMesh.CalculateTriangulation();
|
||
|
|
||
|
Mesh mesh = new Mesh();
|
||
|
mesh.vertices = meshData.vertices;
|
||
|
mesh.triangles = meshData.indices;
|
||
|
|
||
|
GetComponent<MeshFilter>().mesh = mesh;
|
||
|
}
|
||
|
}
|