I’ve been working on a shooting game with some friends, and I’m trying to enable the enemies to track the player using NavMesh. However, the enemy remains stationary instead of moving.
I’ve attempted to reconstruct the navigation mesh, modify the enemy’s configuration, and refer to the Unity documentation, but none of these approaches have resulted in success. Since there are no error messages, it’s challenging to identify what the issue could be.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class EnemyChaser : MonoBehaviour
{
private NavMeshAgent meshAgent;
private GameObject playerObject;
private void Start()
{
meshAgent = GetComponent<NavMeshAgent>();
}
private void update()
{
playerObject = GameObject.FindGameObjectWithTag("Player");
if(playerObject != null)
{
meshAgent.destination = playerObject.transform.position;
}
else
{
Debug.Log("Player not found");
}
}
}
Does anyone have insights on what might be happening here?