'Unity navMeshAgent not working on terrain

The Unity Navmeshagent is not working !on terrain!. I'm very kinda new to unity and need help with the navmesh agent.

It's baking fine just that the entity or slender man is not moving. It's actually in the inspector but it's only like 0.0001 per second. Bake and navmesh agent settings are the photos.

Script:

using UnityEngine;
using UnityEngine.AI;

public class enemymovement : MonoBehaviour
{
    private NavMeshAgent nma;
    public Transform player;
    private void Awake()
    {
        nma = GetComponent<NavMeshAgent>();
        StartCoroutine("followpath");
    }

    private IEnumerator followpath()
    {
        while (true)
        {
            nma.SetDestination(player.position);
            yield return new WaitForSeconds(0.1f);
        }
    }
}


Solution 1:[1]

You need to use nma.SetDestination(player.position)

And don't put this in an update because it means that your agent will try to calculate a new path in every frame. I suggest using a Coroutine that will call SetDestination from time to time instead of every update.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1