Search Unity

Rpc cannot have abstract parameters???

Discussion in 'Multiplayer' started by deLord, Feb 18, 2017.

  1. deLord

    deLord

    Joined:
    Oct 11, 2014
    Posts:
    306
    The method looking like this
    Code (CSharp):
    1. [ClientRpc]
    2. void RpcCreateTile(Tile newTile, int x, int y, bool makeBlue){...}
    Ummm... how do I circumvent this limitation and why is it there?? I have an abstract class Tile with several derivates and I don't want to write a method for every single derivate.
     
  2. srylain

    srylain

    Joined:
    Sep 5, 2013
    Posts:
    159
    • Basic type (byte, int, float, string, UInt64, etc)
    • Built-in Unity math type (Vector3, Quaternion, etc),
    • Arrays of basic types
    • Structs containing allowable types
    • NetworkIdentity
    • NetworkInstanceId
    • NetworkHash128
    • GameObject with a NetworkIdentity component attached.

    These are the allowed arguments inside of an RPC. What does your Tile class contain? Is there any way you can just send an ID value instead of a whole object? Remember that when possible, you want to send as little data as possible.