Search Unity

Instantiated NavMesh movement?

Discussion in 'Navigation' started by MusicBoxx, Dec 4, 2018.

  1. MusicBoxx

    MusicBoxx

    Joined:
    Jul 17, 2018
    Posts:
    23
    Hello,
    I have a NavMesh game object and I've baked the scene and everything and it works perfectly, however if I instantiate the NavMesh Agent then it wont move anywhere.
    I can't drag my "Destination" (empty game object) onto the NavMesh Agent Prefab.

    The current code for NavMeshAgent is simple:

    Code (CSharp):
    1. NavMesh= GetComponent<NavMeshAgent>();
    Code (CSharp):
    1. void Update () {
    2.         NavMesh.SetDestination(Destination.position);
    And it works perfectly. The only issue is that I can't add Destination Game Object to a prefab. Any other solutions?

    Thank you
     
  2. MusicBoxx

    MusicBoxx

    Joined:
    Jul 17, 2018
    Posts:
    23
    [SOLVED]​
    For those of you that are interested I solved the problem by setting the destination to Empty Game Object and from there I can control the prefab.
    As far as I found out it's not possible to put GameObjects on prefabs.