namespace NinoData.Chat
{
[NinoSerialize]
public partial class SystemData
{
[NinoMember(1)]
public string name;
[NinoMember(2)]
public string notice;
}
}
`
namespace NinoData.Chat
{
[NinoSerialize(false)]
public class SystemData
{
[NinoMemberAttribute(1)]
public string name;
[NinoMemberAttribute(2)]
public string notice;
主工程: `using Nino.Serialization;
namespace NinoData.Chat { [NinoSerialize] public partial class SystemData { [NinoMember(1)] public string name; [NinoMember(2)] public string notice; } } `
热更工程: ` NinoData.Chat.SystemData systemData=new NinoData.Chat.SystemData() { name="111",notice="222"}; var dt = Nino.Serialization.Serializer.Serialize(systemData); JEngine.Core.Log.PrintError(BitConverter.ToString(dt)); Nino.Serialization.Deserializer.Deserialize (dt);
能输出序列化的byte 反序列化报错: TargetException: Non-static field requires a target System.Reflection.RuntimeFieldInfo.SetValue (System.Object obj, System.Object val, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) (at <1f66344f2f89470293d8b67d71308c07>:0) System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) (at <1f66344f2f89470293d8b67d71308c07>:0) Nino.Serialization.Deserializer.Deserialize (System.Type type, System.Object val, System.Span(System.Byte[],Nino.Serialization.CompressOption)
UI.LoginGame.LoginGame.Start() (at HotUpdateScripts/UI/LoginGame/LoginGame.cs:38)
IL_006a: call !!0 Nino.Serialization.Deserializer::Deserialize(System.Byte[],Nino.Serialization.CompressOption)
UI.LoginGame.LoginGame.Start() (at HotUpdateScripts/UI/LoginGame/LoginGame.cs:38)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
JEngine.Core.Logger:LogException(Exception, Object) (at Assets/Dependencies/JEngine/Core/Logger/LogHandler.cs:201)
UnityEngine.Debug:LogException(Exception)
JEngine.Core.LifeCycleMgr:ExecuteItems(List
1[T] data, Nino.Serialization.Reader reader, Nino.Serialization.CompressOption option, System.Boolean returnDispose) (at Assets/Dependencies/Nino/Serialization/Deserializer.cs:268) Nino.Serialization.Deserializer.Deserialize (System.Type type, System.Byte[] data, Nino.Serialization.CompressOption option) (at Assets/Dependencies/Nino/Serialization/Deserializer.cs:68) Nino.Serialization.ILRuntimeResolver.Deserialize_0 (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject* esp, System.Collections.Generic.List
1[T] mStack, ILRuntime.CLR.Method.CLRMethod method, System.Boolean isNewObj) (at Assets/Dependencies/Nino/Serialization/ILRuntimeResolver.cs:193) ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/Dependencies/ILRuntime/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:2087) Rethrow as ILRuntimeException: Non-static field requires a target IL_006a: call !!0 Nino.Serialization.Deserializer::Deserialize1, Boolean, Func
2) (at Assets/Dependencies/JEngine/Core/Manager/LifeCycleMgr.cs:326) JEngine.Core.LifeCycleMgr:LateUpdate() (at Assets/Dependencies/JEngine/Core/Manager/LifeCycleMgr.cs:485)按F12 查看热更工程的SystemData: `#region 程序集 Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // F:\MoeMaster\MoeMaster\Library\ScriptAssemblies\Assembly-CSharp.dll
endregion
using Nino.Serialization;
namespace NinoData.Chat { [NinoSerialize(false)] public class SystemData { [NinoMemberAttribute(1)] public string name; [NinoMemberAttribute(2)] public string notice;
}`