[RVO + RichAI] How to improve android performance?

Every 5 frames I see spikes.

My AI character has RVO Controller, Seeker, Alternative Path and a modified RichAI attached to it, the RVO Simulator uses default settings and Funnel Simplification is disabled (causes major lag if enabled).

Using Unity 5.2.1p3 and A* 3.7.4



If it is every 5 frames, then it is likely the FindWalls method (not sure why that would be very slow, but anyway).
If you set wallForce to zero, then you should be able to remove the code in the RichAI script that looks like

//Only get walls every 5th frame to save on performance
if (Time.frameCount % 5 == 0) {
	fn.FindWalls (wallBuffer, wallDist);

(I didn’t remove that call when wallForce was zero because I figured users might want to use the nearby wall info for something else, but I guess it is better to just disable it if wallForce is zero).

According to the profiler screenshot, you seem to be getting log messages from the RichAI component, you probably want to check out what those are and possibly disable them since Debug.Log has a pretty high cost.

Thanks for reply, I have switched to RVO+AIPath because requirements have changed and overall it means more AI can be present, however I have one issue with it, that I think RichAI also suffers from, is tonnes of garbage collection (66.8KB) being created by new T(); which if I were to disable or declare out of scope would give me “path already claimed” errors but CPU performance is halved.

(ASTAR_NO_POOLING is not enabled by the way)


 public static T GetPath () {
			T result = new T ();
			return result;
			lock (pool) {
                T result = new T();
                if (pool.Count > 0) {
                    result = pool.Pop ();
				} else {
                    result = new T ();
				result.recycled = false;
				return result;