Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeUtility relies on DateTime #99

Open
soraphis opened this issue Aug 12, 2022 · 1 comment
Open

TimeUtility relies on DateTime #99

soraphis opened this issue Aug 12, 2022 · 1 comment

Comments

@soraphis
Copy link

s_Timers[name] = DateTime.Now.Ticks;

the TimeUtility class is based on DateTime, which means it breaks when pausing the play mode in the editor (timers should not proceed while paused).

Relying on Time.time OR Time.unscaledTime would pause if the game is paused in the editor (or even paused via timeScale in game, for Time.time)

Also the class is missing a "RuntimeInitializeOnLoad" to clear the static dictionary, which means timers would survive the playmode if the faster-playmode-options are used (https://blog.unity.com/technology/enter-play-mode-faster-in-unity-2019-3)

@pavlo-klymentenko
Copy link
Contributor

  1. I think that we don't need to replace current implementation with something that pays attention to Editor.pause. But I'm sure that we have to extend current impl with version that you have requested. It sounds like a good idea for me, thank you.
  2. [RuntimeInitializeOnLoad]. Absolutely agree, should be fixed. Otherwise it might become Editor only timer-tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants