Search Issue Tracker
By Design
Votes
2
Found in
2018.4
2019.4
2019.4.8f1
2020.2
2021.1
2021.2
Issue ID
1305990
Regression
No
Time.time returns 0 in OnDisable method when exiting Play Mode in Editor
Reproduction steps:
1. Download and open the attached project 'Time Bug.zip'
2. Open scene 'SampleScene'
3. Enter Play Mode
4. Exit Play Mode after a few seconds
5. Observe Console
6. (Optional) Build and run the project
7. (Optional) Exit the Application
8. (Optional) Open Player.log and observe it's logging on Application Exit (https://docs.unity3d.com/Manual/LogFiles.html)
Expected result: Time.time in OnDisable method returns the time since first entering Play Mode
Actual result: Time.time in OnDisable method returns 0
Reproducible with: 2018.4.30f1, 2019.4.17f1, 2020.2.1f1, 2021.1.0b3, 2021.2.0a2
Notes: Issue was reproduced in Windows Unity Editor but not in Build.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Localization Group Rules bypasses Locale logic when SharedGroup asset provided
- UI Toolkit World UI Text Field unfocuses immediately when clicking on it using XR Controller
- Crash on CallWindowProcW when entering Play mode for the second time and running the Editor in the background while using System.Windows.Forms functions
- 2D Freeform Light shadows disappear when light center is offset from shape bounds
- Crash on MarkAllDependencies when opening scenes with Assets from the YarnSpinner package
Resolution Note (2022.2.X):
Currently how the resetting behavior is when leaving play mode. Too high of a risk to change.