I have a scene where I can toggle FixedRate on or off at runtime. It’s a pretty weird and uncommon use case (I use it for a “performance tests” scene), but I’m seeing a problem with it and I wonder if it can be solved
Basically, when I toggle my update mode like this:
public void SetUpdateMode(bool fixedUpdate)
{
if (fixedUpdate)
{
World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<FixedStepSimulationSystemGroup>().FixedRateManager = new FixedRateUtils.FixedRateCatchUpManager(Time.fixedDeltaTime);
}
else
{
World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<FixedStepSimulationSystemGroup>().FixedRateManager = null;
}
}
… it looks like the fixed update is trying to catch up since the very start of the game, instead of from the moment I turned it on. It’s like it doesn’t have a way for me to set its “last time I did a fixed update” to the moment I toggled on fixedUpdate instead of time 0.
This is just my theory and I don’t know for sure, but the end result is that it’s trying to simulate like 10000+ frames of fixed update the moment I turn it on, and it struggles to keep up for a while until it finally simulates at a regular rate at some point. Is there any way to solve this?
Note that I still want to have catchup; but I need it to catch up only from the moment I turned it on