0

[Unity] Send Data Objects for BusMethod

asked 2014-10-01 00:40:53 -0800

shlepsheed gravatar image

Hi, i read in this tutorial page that it possible to send a data object but i don't know how to implement it in unity. The case is i want to send a device player profile consist of id (int), name (string) and description(string). Instead of

MsgArg[0] = id;
MsgArg[1] = name;
MsgArg[2] = description;

is there something like

MsgArg = playerData;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-01 15:38:38 -0800

bspencer gravatar image

You can send a struct, but you need to marshal it into a MsgArg and pull it out of the MsgArg. You cannot send the arbitrary object over the wire. In the Java Language Binding you can do this, but that is due to taking advantage of annotation in the class Interface.

If you are interacting between Unity applications you might as well just set each element in the MsgArg.

edit flag offensive delete publish link more

Comments

Thank you for the answer

shlepsheed ( 2014-10-01 18:32:34 -0800 )edit

My data is dynamic (Can send 2 profile or maybe more, like list<profile>) can you give me example of it? I think like : MsgArgProfileA[0] = profile[0].name; MsgArgProfileA[1] = profile[0].index; SendedMsgArg[0] = MsgArgProfileA; MsgArgProfileB[0] = profile[1].name; MsgArgProfileB[1] = profile[1].index; SendedMsgArg[1] = MsgArgProfileB; But then i confused how to set the signature. Can you help me?

shlepsheed ( 2014-10-02 03:58:05 -0800 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-10-01 00:40:53 -0800

Seen: 48 times

Last updated: Oct 01 '14