fgm24/Assets/Scripts/Enemy/EnemyPathFinding.cs

22 lines
466 B
C#
Raw Normal View History

2024-02-02 23:21:12 +01:00
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);
}
}