Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Agents receive setDestination error when my switch changes cases

Discussion in 'Navigation' started by Crackjoe, Apr 22, 2015.

  1. Crackjoe

    Crackjoe

    Joined:
    Feb 5, 2013
    Posts:
    1
    I think I've narrowed down this issue but I'm not entirely sure why it is happening.

    So a little understanding of how things are working.

    I'm pooling all the prefabs that can be set active, these are my enemies.
    each prefab has an AI script that uses InvokeRepeating to call a wander() on my navmesh method. This is done in Start().

    I instantiate them, set them active and give them a location that I can confirm is on my navmesh.
    I then deactivate them all, and spawn the initial wave of characters. they are given specific spawn locations at random.

    when your kill count increases above a certain value then the type of enemies that can become active changes based on some simple logic switch.

    the game starts and the first spawn tier is called via a switch.
    all characters behave perfectly until the case changes in the switch.
    the case switchs to the new spawn tier which is identical except the name of the gameobject.

    the new enemies react and behave exactly as they are supposed to So AWESOME!! whats your problem then?

    well my console fills with SetDestination errors. They appear to be coming from the Void Start() where I call the InvokeRepeating. the method is still being called and the characters are wandering though.

    It appears to have no impact on the game and the way it functions.
    my primary concern is that this error might be causing instability especially on my mobile device.

    I've tried a lot of different things to fix the error but not really sure what to try next.

    looking for suggestions, theories, anything really that might help.