Search Issue Tracker
By Design
Votes
10
Found in
2020.2.0a16
2020.2.0a17
Issue ID
1262293
Regression
No
Editor throws warning when adding a Scriptable Object as a sub asset using AssetDatabase.AddObjectToAsset
How to reproduce:
1. Open attached project "case1262293.zip"
2. Select "MainAsset" in the Project window
3. Click the "Add" button in the Inspector window
4. Observe the warning in the Console window
Expected: No warnings in the Console window
Actual: Warning "Importer(NativeFormatImporter) generated inconsistent result" is thrown in the Console window
Reproducible with: 2020.2.0a16, 2020.2.0a18
Not reproducible with: 2018.4.25f1, 2019.4.4f1, 2020.1.0b16, 2020.2.0a15
Comments (2)
-
NikoBay
Nov 18, 2021 08:25
Using AssetDatabase.AddObjectToAsset() does not solve the problem and even creates more error:
"The asset at Assets/***.asset has been scheduled for reimport during the Refresh loop and Loading of it has been attempted.
Doing this can lead to the AssetDatabase returning two versions of the same asset...."
How can we open this issue again? -
onembitshorde
Nov 13, 2020 23:57
This is actually happening to me in 2020.2.0b11. Mostly with Scriptable Objects and by reference.
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 UndoManager::RegisterUndoInternal when applying added GameObjects to a Prefab
- [Asset Bundles] A new bundle hash is not generated when the name of a serialized field is changed
- Icon section shows incomplete message and unusable check box in Build Profiles and Player Settings window instead of “Not applicable for this platform” for Dedicated Server Platform
- Assets are created in the Package folders when creating assets via custom buttons in the Inspector window or other windows
- “Select” windows are named differently on Windows and macOS
Resolution Note:
Although the warning is new, it is correctly flagging an issue.
When using AssetDatabase.AddObjectToAsset(), the changes in memory must be saved to disk using AssetDatabase.SaveAssets() . Failure to do this causes the inconsistent result warning, because the in-memory changes are not synchronised with the asset on disk.
The documentation is being updated to explicitly call this out.