Unserialize in Unity3D

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

mumbi
Posts: 4
Joined: 09 Dec 2010, 05:30

Unserialize in Unity3D

Postby mumbi » 14 Dec 2010, 09:11

Hello.

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.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 14 Dec 2010, 15:28

That part of the API is highly non-tested and non-completed yet. Its the next thing to be looked at together with blue box.

Theoretically it *could* work with the current code, but that would make it pure luck :-)

/Thomas

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 20 guests