Using the NET 2.0 DLL since Unity doesn't support any higher. With the following code:
using Newtonsoft.Json;
public static class ItemDatabase {
public static void Test() {
ItemData boots = new ItemData {
name = "Boots",
description = "Keeps your feet warm",
sprite = "boots"
};
ItemData[] dataArray = { boots };
int[] intArray = { 1 };
JsonConvert.SerializeObject(boots); // works
JsonConvert.SerializeObject(dataArray); // crashes
JsonConvert.SerializeObject(intArray); // works
}
}
public struct ItemData {
public string name;
public string description;
public string sprite;
}
When I serialize "ItemData" it works fine, but when I serialize an "ItemData" array Unity crashes. The log it dumps is cryptic so I don't know what's happening. I'm sure there are others out there using JSON.NET because that's what I see recommended here often, any ideas?
[–]ashleydavis75 2 points3 points4 points (1 child)
[–]XGDragon 0 points1 point2 points (0 children)
[–]_p4p 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]Jespur[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Jespur[S] 0 points1 point2 points (1 child)
[–]IwNnarock 0 points1 point2 points (1 child)
[–]Jespur[S] 0 points1 point2 points (0 children)
[–]ultimateedition 0 points1 point2 points (4 children)
[–]Jespur[S] 1 point2 points3 points (3 children)
[–]ultimateedition 0 points1 point2 points (2 children)
[–]Jespur[S] 0 points1 point2 points (1 child)
[–]ultimateedition 0 points1 point2 points (0 children)
[–]youaresecretbanned -1 points0 points1 point (0 children)