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