- Home /
How to keep menu interactable during framerate drop
I'm working on an evolution simulator project right now that can sometimes get quite computationally intensive, especially as the creatures in the simulation can multiply exponentially. To help deal with this, I've created a slider that controls Time.timeScale, so that if I notice the framerate dropping too low, I can drop the timeScale to save it from freezing up completely. However, if I'm too slow, I can sometimes miss my chance and end up with extremely low framerates to the point that the simulation becomes totally uninteractable.
My question is if there is any way to prioritize the GUI slider (and other menu items in general) over the physics simulation so that even if the simulation itself gets extremely laggy, the slider is still usable. Any help would be appreciated! Thanks!
Answer by Zaeran · Dec 31, 2020 at 08:40 PM
There is not unfortunately.
What you could do constantly check the currently framerate via Time.deltaTime, and if it's below a certain threshold, automatically adjust the timescale.
That way you can have a dynamically adjusting timescale and keep things relatively smooth.
Your answer
Follow this Question
Related Questions
Unity 2017 frame rate capped? 2 Answers
Game Freezes upon successive loads 0 Answers
low FPS when battery is low ( unity android ) 0 Answers
alternative of update function that is not frame dependent ? 2 Answers
Frame rate issue for mobile 1 Answer