Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice
  2. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

AI Mesh Agent jumps to other platform after instantiate.

Discussion in 'Navigation' started by Elian_Adrian, Dec 5, 2021.

  1. Elian_Adrian


    Feb 22, 2018
    Hi All,

    I'm having a really strange issue/ bug that i can't figure out
    I am trying to spawn some enemies (containing NavMesh Agent script) on the B platform at the red star sign with the main character target and AI destination also on the B platform.
    Immediately after being spawned the AI jump to the A platform to the circle sign and they aren't able to reach the B platform.

    If i try to spawn the AI anywhere on the A platform and the AI destination is also on the A platform everything works fine and i have no issues.

    If i join the two platforms, and try to spawn the AI on the B platform, i don't have an issue, they spawn correctly at the asterisk sign

    The only issue is when i have the setup below and i don't know why.

    Can you please help me ?

    I spawn the using the code below :

    Code (CSharp):
    1. int r = rnd.Next(groupOfEnemies.Count);
    2. var enemy = Instantiate(groupOfEnemies[r]);
    3.                 enemy.transform.position = gameObject.transform.position;

  2. Elian_Adrian


    Feb 22, 2018
    As an update, while the game is running, if i try to select the AI and drag in the Editor the over to surface B, i can't pass the edge of platform A. I can move the AI backwards towards the platform A center, but not passed it's edge.
    Additionally, if i take a prefab and place it on platform B before starting the game the AI will behave normal. This issue only occurs with instantiated enemy AI Prefabs.
  3. Zoryth


    Dec 5, 2016
    Elian_Adrian likes this.