Forum rules - please read before posting.

Statehandler performance issues

edited March 2023 in Technical Q&A

Hi!

This is my first time posting here and I'm relatively new to unity in general so bear with me.

I've been trying to improve performance in my game because certain scenes run too slowly (15-25ish fps). The game is a 2D point and click first person game that shows movement by jumping around by way of hotspots to different cameras that display static images.

I've traced the performance issue to the statehandler.update > persistent engine > statehandler script. Running this script accounts for about 90% of the game's CPU usage.

This is probably a vague question and I can give more details if necessary, but is there anything I could do within my game to improve the performance of this script, or is this just the nature of the script itself? Are there any common processes that tend to bog this down?

Thanks in advance for any help or suggestions!

Comments

  • edited March 2023

    Welcome to the community, @onionface.

    The StateHandler script is the main "engine" that drives AC at runtime. It's in charge of updating AC's various systems each frame, so ultimately any slowdown will appear to come from the StateHandler, even if it itself isn't the source.

    If you're using Unity's Profiler window to debug slowdown, enable "Deep Profile", and keep drilling down beyond the StateHandler calls - that should help reveal where the issue is ultimately coming from. You're welcome to share screenshots of the window.

    You mention this only occuring in certain scenes - is there any difference you can tell in the way such scenes are set up?

  • Hi Chris, thanks so much for the response!

    I ran the deep profiler and it turns out I'm a total idiot, I traced the issue down the... editor loop. I ran the profiler on a standalone build and the game ran great.

    I honestly didn't even think the editor usage would be profiled as well. Live and learn.

    Thanks for your help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.