Search Issue Tracker
Duplicate
Votes
0
Found in
2020.3
2020.3.13f1
2021.1
2021.2
2022.1
Issue ID
1350006
Regression
No
Scriptable Object references are lost when overwritten by FromJsonOverwrite
How to reproduce:
1. Open the user attached project "ProjectAnomaly.zip"
2. Enter Play Mode
3. In the Game view, turn Around with a mouse
4. Near a red house, you will see a blue character, go near him with W/A/S/D
5. Press "E" when a UI element pops up
6. Select "What's up?" dialogue option
7. Press the right mouse button to go through the dialogue
8. When you regain movement, exit Play Mode
9. In the Project browser search bar, enter "Case Records"
10. Select Scriptable Object "Case Records"
11. In the Inspector window, observe that there are 2 elements in the "Received Cases" called "Case Test (Case SO)"
12. Close and reopen the project
13. In the project browser select "Case Records"
14. In the Inspector window, observe the "Received Cases"
Expected result: There are the same 2 elements called "Case Test (Case SO)"
Actual result: There are no references
Reproducible with: 2020.3.13f1, 2020.3.15f2, 2021.1.16f1, 2021.2.0b6, 2022.1.0a5
Can't reproduce with: 2019.4.29f1 (Compiler errors)
Note:
-Delete the "Project Anomaly" folder from the persistent data path to reset the save files
-If the references are removed in "Case Records" and Play Mode is entered before reopening the project, the "Case Records" will be overwritten (loaded) properly
Note: the project uses JSONUtility to save an object in Playmode in the editor. Then it reloads the object in the editor with JsonUtility.FromJsonOverwrite. Currently, references to objects saved in Editor by JSONUtility will record the instance id of the object, which is not persisted, and hence will not point to the correct object again after the project reloads. Using EditorJSONUtility might be a workaround for JSON written from playmode in the editor, because it will record more complete reference information, but is not available in the player.
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
- "Modifying the parent of a VisualElement while it’s already being modified is not allowed" error is thrown when entering text and pressing tab in the Search window
- Mesh colliders are not updating their positions of bounds correctly
- Images are missing from the "Open the sprite editor" documentation for 6.0, 6.1 and 6.2
- The previous element in the array is modified when assigning an Asset to a new element of AssetReferenceT
- Unity Perforce Integration: VCS Connection Active State Fails via CLI with Valid Inputs
This is a duplicate of issue #1342327