Hello Everyone I Want to Improve My Movement System So I Start Using Navmesh
I Add NavmeshSurfase To Plane And Add NavmeshAgent To Capsule
After that I Add this Script To Capsule
using UnityEngine;
using UnityEngine.AI;
public class WarriorController : MonoBehaviour
{
[SerializeField] private NavMeshAgent agent;
[SerializeField] private GameObject Destination;
// Start is called before the first frame update
void Awake()
{
agent = GetComponent<NavMeshAgent>();
agent.enabled = true;
}
// Update is called once per frame
void Update()
{
if (agent.isActiveAndEnabled){
agent.SetDestination(Destination.transform.position);
}
//agent.Move(Destination.transform.position);
}
}
Note that GameObject Destination
is A Cube
But I Got This Result Below The Capsule Not Moving How Fix it ???