Search Issue Tracker
Third Party Issue
Votes
0
Found in
2019.4
2020.3
2020.3.12f1
2021.1
2021.2
2022.1
Issue ID
1347682
Regression
No
JsonSerializer.Deserialize<>() returns an empty object
Reproduction steps:
1. Open the attached project "ConvertJSON.zip"
2. Open the Scene "SampleScene"
3. Press Play
Expected result: "gt" is printed in the Console
Actual result: "null" is printed in the Console
Reproducible with: 2019.4.29f1, 2020.3.14f1, 2021.1.15f1, 2021.2.0b4, 2022.1.0a2
Can't test with: 2018.4.36f1 (errors in the Console)
Notes:
- User's json file can be deserialized in .NET Console app
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note:
The code provided uses UnityEngine.JsonUtility. This component works on top of Unity Serialization which only supports serializing fields (not properties). See https://docs.unity3d.com/ScriptReference/JsonUtility.FromJson.html.
The structure in the code have only public properties, which are ignored by Unity Serialization. Changing them to public fields make it work as expected.