Closed esklarski closed 2 years ago
Proly wrap it as extension instead of hard coding it? this way you won't pollute Fungus with bunch of If-elses
I'm not sure extension methods can do all that this needs.
I'm more wondering, if there is any reason to pause Fungus? The simplest would be to eliminate all of the if/else logics and just run Fungus on unscaled time always.
That would introduce breaking change, lots of users pausing their games with it
The idea is to keep the current behavior as the default (scaled time), then the other as an option which can be changed by the users themselves if they prefer to
Well that's why the effort. I hard coded it for my purposes, and didn't need to make a toggle.
Demo scene added.
I've done a bit more research and I can clean this up substantively.
Putting a YieldInstruction function like:
public static YieldInstruction WaitForAdjustedSeconds(float seconds) => useUnscaledTime ? new WaitForSecondsRealtime(seconds) : new WaitForSeconds(seconds);
allows all of the if/else logic to be removed, with scripts only needing to call this one function instead of having a second wait function each and supporting logic:
yield return FungusManager.WaitForAdjustedSeconds(value);
It'll be a few days before I can cleanup the commit tree here.
Description
These changes enable Fungus to run while
Time.timeScale == 0
.What is the current behavior?
If
Time.timeScale
is set to0
Fungus is paused and uninteractableWhat is the new behavior?
I made these changes, sans switch, for a project where I used Fungus for all the menus. I needed to pause 3d gameplay but have a character come up to act as the pause screen menu.
Behaviour Now:
Time.timeScale == 0
Important Notes
Other information
Still a work in progress: