Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

NavMeshPathStatus.PathComplete but 0 corners?

Discussion in 'Navigation' started by svenneve, Jul 17, 2015.

  1. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    66
    I'm just trying to wrap my head around this, and i'm not sure this is a bug, or 'by design'.

    But when we calculate a navmesh and get the NavMeshPathStatus, it will often return PathComplete, but have a length of 0 corners, which in my opinion should return NavMeshPathStatus.PathInvalid.

    Now the workaround is easy, but it does require checking for both the status and the corner length, which can't be good performance wise (though debatable is of course whether or not his would even measure in the whole navigation logic of our script given that a navmesh path calculation is already rather heavy performance wise.)
     
  2. Immanuel-Scholz

    Immanuel-Scholz

    Joined:
    Jun 8, 2013
    Posts:
    221
    If you are only concerned about performance, then think about this: How would Unity implement your request? That's right. They would probably just move your current length-test into their function and set the NavMeshPathStatus accordingly to the length==0. Nothing gained (but most probably nothing lost).

    If you are concerned about the beauty of the interface, just write a wrapper around it or define an extension method. ;)