Unity使用LitJson进行Json的读取保存遇到的坑

1、序列化的脚本变量不能带float变量  改为double

2、脚本不能继承其他类  否则出现 如下报错

NullReferenceException
System.Reflection.MonoProperty.GetterAdapterFrame[Object,String] (System.Reflection.Getter`2 getter, System.Object obj) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:234)
System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:292)
System.Xml.Serialization.XmlTypeMapMember.GetValue (System.Object ob)

留意是否继承自monobehaviour

3、保存时类型要new 一下,不new就显示为null

4、保存时遇到问题

Invalid token '34' in input string    

Invalid character '|' in input string

修改读取代码

5类型改为

猜你喜欢

转载自blog.csdn.net/dlyxaj/article/details/127542362
今日推荐