use the namespace
Using UnityEngine.AI
Then download a navmesh make an empty object and add a component called navmesh surface i think
And add a navmesh agent component to the AI
Then get the players transform
Make a float inSightRange
N then if player.transform.position - in sightrange oh im really sorrh but i cant remember the math to check if player is in sight range
But if he is
Since u have the using UnityEngineAI
agent.destination(player.transform)
This is a very simple variation that im typing from my phone rn so there might be some errors