using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AI;

public class NavMeshGenerator : MonoBehaviour
{
    public Terrain terrain;

    public void GenerateNavMesh()
    {
        if (terrain == null) return;


        NavMeshSurface surface = GetComponent<NavMeshSurface>();
        if (surface == null)
        {
            surface = gameObject.AddComponent<NavMeshSurface>();
        }
        surface.BuildNavMesh();
    }
}