Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Feedback Add a shortcut key for pausing profiling in standalone Profiler

Discussion in '2020.1 Beta' started by liortal, Apr 30, 2020.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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.
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,456
    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 ;)
     
    Last edited: Apr 30, 2020
    liortal likes this.
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    you are the man :)
     
  4. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    what about pausing in a build (profiler in the background)?
     
  5. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,456
    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 ?
     
    Kamyker likes this.
  6. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    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.
    Code (CSharp):
    1. #if DEVELOPMENT_BUILD
    2.         if (Input.GetKeyDown(KeyCode.P))
    3.             Profiler.enabled = !Profiler.enabled;
    4. #endif
    Another way I found without shortcuts is to simply disable runInBackground and just alt/tab.
     
    joser_slipgate and MartinTilo like this.