Firstborn/Assets/Scripts/ShowNavmesh.cs

22 lines
357 B
C#
Raw Normal View History

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;
}
}