fgm24/Assets/Scripts/Enemy/EnemyPathFinding.cs

22 lines
466 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class EnemyPathFinding : MonoBehaviour
{
[SerializeField] private Transform target;
NavMeshAgent agent;
private void Start()
{
agent = GetComponent<NavMeshAgent>();
agent.updateRotation = false;
agent.updateUpAxis = false;
}
private void Update()
{
agent.SetDestination(target.position);
}
}