Search Issue Tracker
Fixed in 2021.2.X
Votes
3
Found in
2019.3.0b11
2019.4.2f1
2020.1.0a13
2020.2
Issue ID
1267939
Regression
Yes
Resources.Load returns 'False' in OnPostprocessAllAssets when the Asset was externally changed and loaded in [InitializeOnLoad]
How to reproduce:
1. Open user-submitted project (Initialize Resources Bug.zip)
2. See the Console window - load result is 'True'(if due to project upgrading/downgrading it's False - restart the Editor)
3. Close the Editor
4. Open Assets/Resources/SampleAsset.asset with a text editor
5. Change the last line(numberField: 2) into another number and save
6. Launch the project again and see the load result
Expected result: load result returns 'True'
Actual result: load result returns 'False'
Reproducible with: 2019.3.0b11, 2019.4.7f1, 2020.1.0a13, 2020.1.1f1, 2020.2.0a20
Not reproducible with: 2018.4.26f1, 2019.3.0b10, 2020.1.0a1, 2020.1.0a12
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
- Incorrect Shader keyword activation for Shadows when no Light is present in URP
- Editor freezes when loading a specific AssetBundle
- WebGPU builds with Multithreading enabled crash on Safari
- Set as Value in UI Builder doesn't work across all properties.
- Reorderable ListView inside a ScrollView has a glitchy behavior when trying to reorder items
Resolution Note (fix version 2021.2):
This is by design - you can't expect to be able to load assets in this callback. Assets get imported after the domain has been loaded. You would get the same kind load failure, if the library folder was deleted.
Instead a new variant of OnPostProcessAllAssets has been added in 2022.1.0a7. This new version includes a didDomainReload boolean to signal if there has been a domain reload. Asset loading is safe in this callback. API documentation has been updated with information about this.
Resolution Note (fix version 2021.2):
A new variant of OnPostProcessAllAssets has been added in 2021.2.0b12. This new version includes a didDomainReload boolean to signal if there has been a domain reload. Asset loading is safe in this callback.