Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Crippling 70 fps drop performance problem in player loop just disappears?

Discussion in 'Testing & Automation' started by DTECTOR, Mar 6, 2023.

  1. DTECTOR

    DTECTOR

    Joined:
    Aug 23, 2020
    Posts:
    132
    Hey guys, so I had a huge performance issue where I was starting many coroutines in a short time frame without yield so they were all running at the same time with a slight delay between each invokation, and it was creating too much overhead and thus on the screen the game would skip and fps would go from 120 to 30-50 instantly. Even if I capped the fps at something like 30 fps, I was still getting the same massive spike. Visually it was unacceptable so I have been looking into alternative ways to implement the desired behavior and just as I found a solution, upon running the original version to show a side by side comparison it now works at a stable 120 fps through the whole sequence that just a few days ago was completely obliterating the frame rate, the same solution that was just crushing the player loop was no longer causing the same spike, how is that possible?
     
  2. DTECTOR

    DTECTOR

    Joined:
    Aug 23, 2020
    Posts:
    132
    Edit, I was mistaken. I had tested an earlier version of my solution and part of it was active and I very smartly encapsulated it in a single character method due to laziness so I overlooked it for hours.