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
- Performance Markers Search window shows an empty entry in the list
- Enabling Deep Profiling in Performance Markers Search window breaks Inspector panel buttons when navigating through the marker items
- Dragging selector from selector row background shows preview but does not apply class in UI Builder
- An "InvalidOperationException" error is thrown when TryRemoveItem is used with rebuildTree set to false
- Build fails with IL2CPP error when building on Android platform in a specific project
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.