TheFrontRoomsGame/Assets/NavMeshBaking/RuntimeBaking.cs
2023-03-24 10:33:36 +00:00

45 lines
No EOL
793 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class RuntimeBaking : MonoBehaviour
{
public NavMeshSurface[] surfaces;
public Transform[] objectsToRotate;
// Use this for initialization
void Start()
{
StartCoroutine(Waiter());
}
IEnumerator Waiter()
{
yield return new WaitForSeconds(0.5f);
for (int j = 0; j < objectsToRotate.Length; j++)
{
objectsToRotate[j].localRotation = Quaternion.Euler(new Vector3(0, 50 * Time.deltaTime, 0) + objectsToRotate[j].localRotation.eulerAngles);
}
for (int i = 0; i < surfaces.Length; i++)
{
surfaces[i].BuildNavMesh();
}
}
}