Search Issue Tracker
By Design
Votes
0
Found in
6000.0.5f1
Issue ID
UUM-73410
Regression
Yes
Resources.Load() fails to load assets created in the same frame when called from a function with the InitializeOnLoadMethod attribute
How to reproduce:
1. Open the attached “resources_load_issue” project
2. In the Project window, delete the “Resources” folder
3. Open the “CreateAndLoadAssetOnIniOnLoadRepro” script (Assets/Bug/CreateAndLoadAssetOnIniOnLoadRepro)
4. Add a line break anywhere in the script
5. Save the changes (CTRL+S)
6. Observe the result in the Console window
Expected result: “Successfully loaded asset“ is printed in the Console
Actual result: “Failed to load asset” is printed in the Console
Reproducible in: 2023.1.0a8, 6000.0.5f1
Not reproducible in: 2021.3.39f1, 2022.3.32f1, 2023.1.0a6
Reproducible on: macOS 14.4.1 (Silicon), Windows 11
Not reproducible on: No other environments tested
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
- Crash on JobQueue::HasJobGroupIDCompleted when closing the Editor while in Play mode on a specific project
- In "Preferences" section the “SpriteShape” menu item, the details page title “SpriteShape”, and “ControlPoint” entries are displayed as code strings rather than formatted UI strings
- Errors thrown constantly when Virtual Offset Debug is enabled and lighting was baked on AMD machine
- Persistent Memory Leak when reloading domain and using Distance-based Ghost Importance
- HDRP project doesn't render in standalone player when using High stripping
Resolution Note:
We can't import newly created assets immediately in an import callback.
This behavior is described in our documentation https://docs.unity3d.com/kr/2023.2/ScriptReference/AssetDatabase.CreateAsset.html
"Note: You should not create assets during import, for example from within a ScriptedImporter or Postprocessor."