Search Unity

Why are arguments of type System.Object not supported for Command or ClientRpc methods?

Discussion in 'Multiplayer' started by eco_bach, Dec 30, 2017.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Hi
    Can anyone tell me why arguments of type System.Object ie object are not supported for Command or ClientRpc methods? Seems like a huge limitation to me.

    Here is my error
    UNetWeaver error: parameter [Object] is of the type [System.Object] is not a valid type, please make sure to use a valid type.

    I think there is a similar issue if using generics
    https://answers.unity.com/questions/1104810/commandclientrpc-with-generic-parameter.html
     
  2. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    Because the serializer the HLAPI is using doesn’t support it. Don’t see how it’s a huge limitation though? Just serialize it to a byte array and send that. Or change the hlapi serializer
     
    Deleted User likes this.