Search Unity

Navmesh API?

Discussion in 'Entity Component System' started by Arowx, Apr 20, 2018.

  1. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Just wondering is there a way to access the Navmesh API in a Job system batch friendly way?
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    Yes. NavMeshQuery. Look at Nordeus keynote demo.
     
    Last edited: Apr 20, 2018
    Arowx likes this.
  3. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    Oh sorry! i'm not clearly read your question, NavMeshQuery can't be used in parallel jobs (i mean for write) only in successive IJob (I am now just doing the calculation of the way on NavMesh in Job)
     
    Last edited: Apr 21, 2018
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,980
    I too am interested in this?
     
  5. adriant

    adriant

    Unity Technologies

    Joined:
    Nov 1, 2016
    Posts:
    69
    Only the methods in NavMeshQuery are compatible with the job system.
    Of all those methods, only
    MoveLocations
    and
    MoveLocationsInSameAreas
    have been implemented to explicitly act on a list/batch of inputs due to the benefit of allocating a single "large" temporary memory buffer which the operation can reuse for all the items in the batch. All other methods can be called individually on the batch items without a significant hit on performance.

    In which scenarios would you need other batch-friendly methods?
     
  6. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,980
    Well currently I have not tried what you have said, i will this weekend and report back with specific use cases and issues if there are any. What you have mentioned should be fine for getting an initial system working though, thankyou
     
  7. vitautart

    vitautart

    Joined:
    May 3, 2018
    Posts:
    29
    As i understand, for now it cant be used for pure entity, without gameobject overhead, because there aren't any navmesh agent component derived from IComponentData.
     
  8. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    For search many paths in parallel?
     
  9. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    you don't need a batching api to do that, just setup a parallelfor job. Individual is much more flexible overall when there aren't any internal reasons to make it a batch api. Batching api's actually cause painful contortions when you want to just insert the call into a sequence of other logic.