I tried to use the new JSON serialization feature in Unity 5.3, and I wrote the following code from the link in the usage example provided on the Unity website. The only thing I did was create the class variables of the objects (FruitItem class in my case) using setter and getter instead of making them pure public variables. By doing this, I only got a pair of curly braces with no content inside. However, if I remove the getter and setter and make the class variables pure public variables, I can get the correct result. Can someone give me some clues why this happened? Thanks in advance for your help.
Code that works correctly:
using UnityEngine; using UnityEditor; using System.Collections; using System; public class testJson : MonoBehaviour {
Code that does not work correctly:
using UnityEngine; using UnityEditor; using System.Collections; using System; public class testJson : MonoBehaviour {
source share