Add a shortcut key for pausing profiling in standalone Profiler

I am playing around with the standalone Profiler.

Right now, on my laptop i kind of have to arrange the Unity editor window and the standalone profiler so i can work in the editor and start / stop profiling.

One thing i've experienced now is that in case i experienced some performance issue i want to examine in the profiler - by the time i get to the profiler to stop recording, it's already gone from the display.

It could be nice to have some sort of keyboard shortcut that can stop recording to improve usability for this kind of scenario.

Hi Lior,

Such a shortcut should already exist. I think the default is F9 but you can check the shortcut manager.

Also, you can extend the amount of frames that are retained in Preferences/Profiler to up to 2000 frames, which should also help. And for the editor, you can also change Preference/General/Interaction Mode torreduce the editor frame rate ;)

1 Like

you are the man :)

what about pausing in a build (profiler in the background)?

I don't think it'd be right for Unity to set hotkeys for Player builds. But you can have your input logic listen for some input combo of your choice and then set Profiler.enable = false ?

1 Like

Thanks, yes that what I was looking for. I had it in my code added long time ago but completely forgot how it was called.

        if (Input.GetKeyDown(KeyCode.P))
            Profiler.enabled = !Profiler.enabled;

Another way I found without shortcuts is to simply disable runInBackground and just alt/tab.