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
  2. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  3. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Random performence spikes due to Semaphore.WaitForSignal

Discussion in '2019.3 Beta' started by Bordeaux_Fox, Jan 19, 2020.

  1. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Hello,

    I see some random performence spikes in my game. Using the profiler I encountered "Sempahore.WaitForSignal" is the cause. So what is this? And how can I track what causes this?
     

    Attached Files:

  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,288
    Check the timeline profiler for that frame and look at what the render thread is doing. The main thread is waiting for it to finish doing some work before it can move on.

    WaitForSignal isn’t the root cause - what it is waiting for is the real culprit :)
     
  3. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    There is nothing under rendering. What should I'm looking for?
    The spike is always some seconds after the scene finished loading, interrupting my cutscene.
     

    Attached Files:

  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,288
    Probably the GPU is rendering too much - it looks like the GPU workload is limiting the framerate.
     
  5. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Only one second during complete gameplay?
    It seems to me the scene is not fully loaded. If I would hide the screen for some seconds before the cutscene starts, the player would never see the spike. So wait some seconds after Awake.

    I tried several things:

    Disable all shadows, disable all post procress, disable all skinned mesh, disable all custom scripts. Nevertheless I get the spike in first couple of seconds.
     
    Last edited: Feb 3, 2020