I use sfs2X with unity3D 3.1
I tried to use class serialization.
I succeeded in sending the object serialized from server to client.
and I received the object serialized on client.
But I can't obtain original object.
code like following..
Code: Select all
// server.
ISFSArray messages = new SFSArray();
messages.addClass( new Message( senderId, title, time ) ); // Message class implements SerializableSFSType and all fields are public and provide empty constructor. so It is serialized well.
messages.addClass( new Message( senderId, title, time ) );
...
ISFSObject result = new SFSObject();
result.putSFSArray( "messages", messages );
send( "messages", result, sender );
// above code is on server and send serialized object array well.
// client Unity3D
ISFSObject result evt.Params["params"] as ISFSObject;
ISFSArray messages = result.GetSFSArray( "messages" );
for..
ISFSObject message = messages.GetClass( i ) as ISFSObject;
// here message is the received object serialized.
I don't know how to unserialize the object.
plz give me a tip.
thanks for reading event though my English is poor.