Search Issue Tracker
Fixed in 2022.1.X
Votes
3
Found in
2019.4
2020.3
2020.3.18f1
2021.1
2021.2
2022.1
Issue ID
1364809
Regression
No
Accessing a Scriptable Object with InitializeOnLoad provides null values when Reload Domain is disabled
How to reproduce:
1. Open the user's attached project
2. Open scene Scenes/SampleScene
3. Make sure that Domain Reloading is disabled (Project Settings -> Editor -> Reload Domain (under "Enter Play Mode Settings) -> unchecked)
4. Press the Play button
5. Observe the Console
6. Press the Play button again to stop playing
7. Enable Domain Reloading (Project Settings -> Editor -> Reload Domain (under "Enter Play Mode Settings) -> checked)
8. Press the Play button again
9. Observe the Console
Expected result: no errors regarding missing references or null values are thrown
Actual result: MissingReferenceException is thrown after initially playing the project, the error is resolved after enabling Reload Domain
Reproducible with: 2019.4.30f1, 2020.3.18f1, 2021.1.21f1, 2021.2.0b12, 2022.1.0a8
-
Delvatron
Sep 14, 2021 20:35
It's a runtime error in editor mode only. But it is present when assets are loaded in a InitializeOnLoad context (when using GetPreloadedAssets for instance). Since domain reloading is disabled, upon running the game the assets are not completly loaded (and will never be until next domain reload which will reload memory)
-
tomachinz
Sep 14, 2021 16:05
Isn't that a runtime error?
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
- [Mobile] Developer Console does not appear when an error is thrown
- [HDRP] Game view renders artifacts when Camera's Component "Post Anti-aliasing" is set to "TAA" and Dynamic Resolution's "Forced Screen Percentage" is changed
- A deactivated Prefab's name color becomes white when a GameObject in the scene is deactivated
- The Game view becomes blank when using Frame Debugger with MSAA and Texture binding enabled in Play Mode
- NullReferenceException is thrown when changing the Inspector preview selection
Resolution Note (fix version 2022.1):
Fixed in 2022.1.0a12