Killing Peformance

Hi Everyone,
I seem to have a performance problem that has creeped up on me behind my back. The path calculation times have increased dramatically when running on ipad2, taking several seconds which I haven’t noticed as I’ve used a never device for development.

The Main Problem seem to be the “” that absolutely kills it.

I got a large unit that I move across the grid that I want the smaller units to avoid and for this I’m using UpdateGraphs, although not every frame.

My Setup:
-2 Grid Graphs

  • About 10 simultaneous units
  • A Large moving unit with ";" (not every frame:)

Any suggestions on how optimise…or even replace the whole graph update thing.




It is pretty hard to do graph updating on mobile platforms since they are very slow.
First, try to see if you can reduce the graph resolution, that will help a lot.

Can you use the DynamicGridObstacle script? That will only update the graph if the position of the object has changed more than some threshold, which might make a it a bit faster.

I guess you could try with a recast graph and using navmesh cutting (, if you are really lucky, it might be faster in your case.

Turn off erosion and height testing on the grid graph if you can (especially erosion is pretty expensive).

Finally had time to try this properly and yes, using recast graph is faster. I had to catch the graphs and disable the zip on iOS to get it to work as I was getting this error:

Pathfinding.Ionic.Zip.ZipException: Bad date/time format in the zip file.

(using unity 4.6.2p1 il2cpp 64bit iOS)

Thanks for the help. it certainly did the job!