[Help!] AI doesnt run and follow

Hi, i need a help to make my AI wander around and chase the player.
But somehow it doesnt work-- did i miss one or two code? ;;v;:wink:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class Enemy : MonoBehaviour
{
    public class EnemyController : MonoBehaviour
    {
        GameObject Shadow;
        NavMeshAgent agent;


        void Start()
        {
            Shadow = GameObject.FindGameObjectWithTag("Player");
            agent = GetComponent<NavMeshAgent>();
        }

        // Update is called once per frame
        void Update()
        {
            agent.destination = Shadow.transform.position;
        }
    }
}

Have you setup the navmesh - if you move things around it may become invalid and you have to rebake it.

If you use: bool gotPath = SetDestination( Shadow.transform.position ) you can then Debug.Log( gotPath ) to tell if youโ€™re getting a path or not.