Home > other >  Protobuf - net in Unity use int64 (long), analytical disorder problem in IOS device.. Mono in IOS bu
Protobuf - net in Unity use int64 (long), analytical disorder problem in IOS device.. Mono in IOS bu

Time:09-22


In c # parse protobuf used the protobuf - net, has been using normal,, but recently on apple mobile phone, a puzzling question,
Finally found is the Int64 field either parse out a big, big, anyway,,

Tracking found
PropertyDecorator.
in cs

Object newVal=Tail. Read (oldVal, source);
If (readOptionsWriteValue & amp; & NewVal!=null)//if the tail returns a null, intepret that no assign as * *
{
If (shadowSetter==null)
{
Property. SetValue (value, newVal, null);
}
The else
{
ShadowSetter. Invoke (value, the new object [] {newVal});
}
}


NewVal read is right,,,,
Go to the property. The SetValue (reflection mechanism assignment), get the value of the result is a big mess of numerical,,,,


It seems can not use protobuf -.net or don't use of 64 field,

Do you have any good Unity with protobuf solution?





At present we are using Unity3D 5.3
Reflection mechanism has a problem, should be a Mono directly write a test code:

Public class Test_Reflect
{
Long id=0;

Public long ID
{
The get {return id; }
The set {
ClientLog. Log (" @ @ @ @ set_ID: "+ value);
Id=value; }
}

Public void set_id1 (long _i)
{
ClientLog. Log (" @ @ @ @ set_id1: "+ _i);
Id=_i;
}
Public void set_id2 (System. Int64 _i)
{
ClientLog. Log (" @ @ @ @ set_id2: "+ _i);
Id=_i;
}
}

Test_Reflect tr=new Test_Reflect ();
Long tt=1000000000 l;
Foreach (PropertyInfo property in the tr. GetType (). The GetProperties ())
{
//the type of output properties and variable name
ClientLog. Log (" @ @ @ @ test reflect "+ property. The Name +" : "+ property. PropertyType. The ToString ());
Property. SetValue (tr, tt, null);
}
Tr. GetType (). GetMethod (" set_id1 "). The Invoke (tr, new object [] {tt + 1});
Tr. GetType (). GetMethod (" set_id2 "). The Invoke (tr, new object [] {tt + 2});


Run on IOS devices, as long as the reflection mechanism to obtain values are wrong,,,,


CodePudding user response:

Nobody know the reason or solution?


The hedge only, need not 64 field; Or all in lua resolution protocol; Or must be pass with a 64 - bit string in c #,,,

CodePudding user response:

The protobuf used in the source code on the unity of instead of a DLL file, use the DLL file is can't use on ios, because ios runs are not allowed to load the other things
  • Related