Navmesh with enemy ai to chase player and attack

Hello Friends,
I have made a navmesh to my enemy, to move towards a particular location. If in between his path, if my player comes into the vision of enemy, the enemy should start chasing the player and attack him. Can anyone suggest me a result for it.

Sounds similar to my set up. I have the enemy on a waypoint system. as he reaches each waypoint ( it’s trigger) it directs him to another waypoint. But I found that the waypoint system interfered when it came time for him to attack. SO the answer is in the attack script itself, that when the player is within the range parameters, I SetActive (false) the gameobject holding the waypoints and agent.SetDestination as the player. But as far as attacking? That again is in your attack script. Do you have one?

You need to make a state machine. Use the enumeration type to set up 2 states, patrolling and attacking. The enemy will then either execute just the patrol codes, or the attack codes, depending on his state.