- Home /
Pathfinding with NavmeshAgents in Unity 5?
Is there a good boost in path finding performance in Unity 5, (obviously for anyone who's got access)? I gather that path finding performance using Unity NavmeshAgents is one area that is being updated for Unity 5 which I think some people have access to the beta(?). I don't have access to that. What sort of magnitude improvement are we talking about?
Why ask? I am the point right now of making game design decision for what I can consider doing with my AI path finding. The bottleneck in Unity 4.x, (for me), is currently the time it takes to do path finding calculations. (Alternatives to Unity Navmeshagents fail for me in other respects). I want to set my game limitations based on Unity 5 because it should be out well within the development time frame of my game and I could really do with being able to make some kind of decision based on what is likely to be the capability with that. I guess a lot of other folks would benefit too and not knowing places constraints on folks design decisions, it would be great to know.
Answer by Gerlon · Feb 03, 2015 at 03:48 PM
I can give you some results but don't take me to seriously, I might have different conditions and it was jus a raw test. I have created a scene with 401 agents. One in the middle where those other 400 try to pathfind to. Moreover Iam using an extended pathfinding script which improves/changes the local avoidance at the target a bit, basically makes them stop and not jittering around. That took in Unity 4 like ~5ms to update, no optimization or anything generally there is no need to update every frame at all. Moreover the CrowdManager took like ~3ms to calculate.
The differences in U5 which I noticed so far are: setDestination seems a lot faster so the Update Script took only 1.5ms, huge improvement. A definitly more specific feature: the CrowdManager now is called NavmeshManager and took about ~0.9ms, so that is definitly faster. Workerthreads are calculationg most of that now, from what I have seen in the profiler. In addition I have noticed a visual differnce in the calculated navmesh which seems to be way more acurate, in U4 there were some holes and errors visually.
So overall Pathfinding seems a lot better, if they actually made it faster or just U5 runs overall faster I cannot tell. But the U5 performance is an huge gain, no matter from what source. I hope that helps
That's great, Gerlon, thank you for your answer, very helpful.
Your answer