Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.2
2019.3
2019.3.0b8
2020.1
Issue ID
1198293
Regression
No
[Android] Static objects do not get destroyed when loading an application after Application.Unload was called
To reproduce:
1. Open the QA's attached project "staticRemainRepro"
2. Build and Run on Android with Development Build selected
3. Press "Unload"
4. Load the application
5. Observe the logcat
Expected result: Static variables are destroyed after Application.Unload and then loaded again after the application is loaded
Actual result: "Static initialized flag's value is True" line is printed indicating that there already is a static variable after the application was unloaded and then loaded
Reproduced with: 2018.4.13f1, 2019.2.13f1, 2019.3.0b12, 2020.1.0a14
Reproduces with Android (IL2CPP, Mono). App freezes on iOS devices on Application.Unload. UWP build fails.
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
- Crash on __pthread_kill when initializing Vuplex WebView while entering the Play Mode
- Crash on FindSurface when adding a custom Renderer Feature to a 2D Renderer Data Asset
- [Android] [Vulkan] [UI Toolkit] Application crashes when the device is rotated when it has UI Toolkit TextField on Vulkan devices
- Crash on DualThreadAllocator<DynamicHeapAllocator>::TryDeallocate when opening a specific project
- Crash on memset_repstos when pressing a UI button while in Play Mode
Resolution Note (2020.1.X):
Currently this is by design and it would be a major feature request to make it work the desired way (major scripting feature).
User should either not rely on/use statics (a script attached to game object that is DontDestroyOnLoad is one way), or make them handle reload.