这是什么问题啊!
error CS0246: The type or namespace name 'NavMeshAgent' could not be found (are you missing a using directive or an assembly reference?)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof (NavMeshAgent))]
public class Enemy : MonoBehaviour{
NavMeshAgent pathfinder;
Transform target;
void Start(){
pathfinder = GetComponent<NavMeshAgent>();
target = GameObject.FindGameObjectWithTag("Player").transform;
}
void Update(){
pathfinder.SetDestination (target.position);
}
}
缺少命名空间引用,加上using UnityEngine.AI