Search Issue Tracker
Fixed in 2022.1.X
Fixed in 2021.2.X
Votes
0
Found in
2020.1
2020.1.0b16
2020.2
2021.1
Issue ID
1274994
Regression
Yes
Calling LoadAssetAtPath during DomainReload returns null asset if asset is in modification list as well as a script
How to reproduce:
1. Create an asset (i.e. a shader)
2. Create a class with [InitializeOnLoad] in it, and call AssetDatabase.LoadAssetAtPath(path_to_shader) in the constructor, notice result is NOT null.
3. Focus back to the editor
4. Modify the .shader and the C# script without focusing back on the editor
5. Refresh the editor
Reproduces with: 2020.1.0b16, 2020.1.17f1, 2020.2.0f1, 2021.1.0a10
Does not reproduce with: 2019.4.17f1, 2020.1.0b15
Could not test with: 2018.4.30f1
Expected results: The result of AssetDatabase.LoadAssetAtPath is not null
Actual results: The result of AssetDatabase.LoadAssetAtPath is null
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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note (fix version 2022.1):
Fixed in: 2022.1.0a7
InitializeOnLoad shouldn't be used for asset loading, because it is called before asset importing is completed. A new variant of OnPostProcessAllAssets has been added and documented:
https://docs.unity3d.com/2021.2/Documentation/ScriptReference/AssetPostprocessor.OnPostprocessAllAssets.html
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0b13