uLink - RPC acceptable argument type

Hi there,

I was wondering if the types outlined here:

http://developer.muchdifferent.com/unitypark/uLink/Serialization

…Can be used as RPC arguments.

For example, would the following work: (Assume everything is public.)

struct MyStruct {
   int a, b, c;
   float x, y, z;
   int[] myIntArray;
}
...
networkView.RPC("MyRpc", 
    new MyStruct(...), 
    new int[] {1, 2, 3});
...
void MyRpc(MyStruct myStruct, int[] intArray, uLink.NetworkMessageInfo info) {
    ...    
}

Note that X is a struct, not a class. uLink mentions classes in #6 but not structs, I assume it doesn’t care which one you use.

Also, is the uLink.NetworkMessageInfo argument optional? Sometimes I don’t use it, and I’d rather not include it when I don’t use it as it makes the code a little uglier.

Thanks for your help! :smile:

Hi, First of all it’s better to ask uLink related quesitons in forum.muchdifferent.com , secondly you are able to pass any struct/class if you write a serializer for it or if it only uses types which uLink can serialize as it’s manual said. Vector3 is a struct for example which is supported by default so you can write your own structs and serialize them and send them. Most of the times writing your custom serialization code as described in manual is a good practice and helps you save bandwidth by not sending unrequired data.