using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using NavMeshPlus.Components;

public class NavmeshUpdate : MonoBehaviour
{
    NavMeshSurface navMeshSurface;
    float TimeToUpdate = 1.0f;

    private void Awake()
    {
        navMeshSurface = GetComponent<NavMeshSurface>();
    }

    // Start is called before the first frame update
   
    // Update is called once per frame
    void Update()
    {
        if(TimeToUpdate <= 0)
        {
            TimeToUpdate = 1.0f;
            navMeshSurface.UpdateNavMesh(navMeshSurface.navMeshData);
        }

        TimeToUpdate -= Time.deltaTime;
    }
}
