I am now doing some optimization in my game to find out how much visual fidelity I can go with. I combined meshes and reduced drawcalls but already after a short time suddenly AC is the main culprit for performance.
- There seem to be constant object activations and deactivations going on (expensive!)
- There is constantly significant memory allocated, resulting in constant garbage collections (red line and huge CPU spikes)
Is there a way to get this CPU and memory activity down? I think an optimization pass on AC would really be benefitial to all users :-)
Comments
AC implements a try/catch routine so that non-existing inputs don't throw an error. I wonder if that causes a performance hit. Try removing the try {}, catch {} lines inside it - does that improve things?
The StateHandler's Update function is pretty much the only Update function in AC - all other script updates get called from this, so it's doing the bulk of the work. The SetProximity function is only called if you have Highlight Hotspots based on cursor proximity? checked.
To integrate Rewired into AC, you would override the input checks completely, so the option wouldn't actually have an effect. Tony, the creator of Dialogue System, wrote a code snippet here.
The Horizontal and Vertical can still be added - you can use the Player: Constrain Action to disable player-driven movement.
Inputs
Have you expanded the Profiler to show more detail about specifically where in the StateHandler the expense is? Keep in mind that the AdvGame.GetMainViewSize() method, which you may find inside its hierarchy, is a main contender of performance hits but only when running in the Editor.
The "Performance and optimisation" chapter of the Manual covers more points on boosting performance.
Didn't know about that chapter, will go through it, thanks.
So it doesn't matter how I define those inputs as long as they are defined somehow?