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;
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;
}
}
}