-2
\$\begingroup\$

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.

Setup Picture

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);
    }
}
\$\endgroup\$
3
\$\begingroup\$

You need to bake a navmesh first.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.