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
- SpeedTree does not move when using WindZone
- "Undeclared identifier 'LinearToSRGB'" error is thrown when creating a color variable with HDR color mode and assigning a Custom Render Texture target in Shader Graph
- Input System package is missing when creating a new HDRP project
- Inconsistent behaviour when interacting with different dropdown types with pointer events on parent Visual Element
- Hidden GameObjects won't re-enable when they have call "DontDestroyOnLoad" function
Resolution Note (fix version 2022.1):
Fixed in 2022.1.0a12