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

Scripting

-

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

  1. Resolution Note (fix version 2022.1):

    Fixed in 2022.1.0a12

Comments (2)

  1. 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)

  2. tomachinz

    Sep 14, 2021 16:05

    Isn't that a runtime error?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.