1
我想在Unity上使用Json.NET來序列化一個類。
類多邊形包含陣列的 Vector2但我只想要序列x和Vector2類Y的變量,這就是爲什麼我使用的JsonConverter屬性。使用Json.NET序列化Vector2的數組
Sample類:
public class Polygon
{
public int count { get; set; }
[JsonConverter(typeof(Vector2Converter[]))]
public Vector2[] points { get; set; }
}
它給了我在運行這個錯誤:
MissingMethodException:未找到方法:「默認的構造不 發現...的ctor(的 ) JsonDotNet.Extras.CustomConverters.Vector2Converter []
任何人有任何建議?
感謝Brian的幫助 – John 2015-02-09 12:01:36
沒問題;我很高興你發現我的答案有用。 – 2015-02-09 14:55:10