I've got some data I need to serialize/deserialize, but JsonUtility is just not doing what it's supposed to. Here's the objects I'm working with:
public class SpriteData {
public string sprite_name;
public Vector2 sprite_size;
public List<Vector2> subimage;
}
public class SpriteDataCollection
{
public SpriteData[] sprites;
}
If I create a SpriteDataCollection, and attempt to serialize it with JsonUtility, I just get an empty object {}. Here's how it's being built:
SpriteData data = new SpriteData();
data.sprite_name = "idle";
data.sprite_size = new Vector2(64.0f, 64.0f);
data.subimage = new List<Vector2> { new Vector2(0.0f, 0.0f) };
SpriteDataCollection col = new SpriteDataCollection();
col.sprites = new SpriteData[] { data };
Debug.Log(JsonUtility.ToJson(col));
The debug log only prints "{}". Why isn't it serializing anything? I've tested it out, and serializing a single SpriteData does exactly what it's supposed to do, but it won't work in the SpriteDataCollection.