I am making a game in unity and it is throwing the error "Failed to create agent because there is no valid NavMesh" and i don't know what the problem is.
using UnityEngine;
using System.Collections;
public class EnemyMotion : MonoBehaviour {
public NavMeshAgent agent;
public Rigidbody rb;
public GameObject otwt;
void Start () {
rb = GetComponent<Rigidbody>();
agent = GetComponent<NavMeshAgent>();
}
void Update () {
gameObject.transform.Rotate(270, 0, 0);
agent.SetDestination(otwt.transform.position);
}
}
This will bake the NavMesh and your NavMeshAgent will now work. Right now you have no NavMesh, so your Agents don't know where they can move/walk.