Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4.6f1
2020.2
Issue ID
1273706
Regression
No
[ScriptableObject] Script loses reference to ScriptableObject after compilation error is encountered and then fixed
Reproduction steps:
1. Open attached project "Scriptable.zip" and scene "ScriptableObjectIssue"
2. In Project window, open "MyBuggyScript.cs"
3. In "MyBuggyScript.cs", uncomment line 7
4. Restart Unity Editor
5. In "MyBuggyScript.cs", comment out line 7
6. In Hierarchy window, select "My SO Container" GameObject
7. Observe "My Scriptable Object" field
Expected result: There is a reference to the scriptable object
Actual result: There is no reference to a scriptable object
Reproducible with: 2018.4.27f1, 2019.4.9f1, 2020.1.4f1, 2020.2.0b1
Comments (1)
-
ChrisIceBox
Sep 01, 2020 08:01
The object is not unsaved - the data is lost. Please re-open this issue. Data that was part of the scene file being is lost.
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
- "One or more data file missing for baking set NewScene Baking Set. Cannot load shared data." error in Player when a specific project is built
- Choosing new HDR Colour using RGB values breaks colour on Intensity Selectors
- Rendering/Decal Layer Mask options are different inside Prefab Mode and outside Prefab Mode when the project is upgraded to Unity 6
- Incorrect Realtime GI Light Probes baking when more than one Light Probe Group is used and "Baked Global Illumination" is enabled
- Hovering on the three-dot menu also highlights the tab header near it when not all tabs fit the bar
Resolution Note:
The behavior for unsaved assets is undeterministic in this scenario, in order to address this you should save the asset in the asset database at creation time: AssetDatabase.CreateAsset(myScriptableObject, "Assets/MyScriptableObject");