Search Unity

automatic type conversion and RPC

Discussion in 'Multiplayer' started by llavigne, Aug 20, 2008.

  1. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    I have the following RPC call:
    RPC ("Function", int, int)

    calling the following function :
    Function (byte, byte)

    what gets sent through the network? an int or a byte ?

    And is there explicit type conversion commands in JS?
     
  2. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    280
    It shouldn't be possible to call an RPC function with incorrect types in the parameter list. You should get an error. What do the exact code lines look like? In any case the types passed to the RPC function are sent over the network and they are interpreted on the other side according to the RPC function definition there.
     
  3. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    I noticed ... RPC doesn't support bytes ...
    (request # 34189)
     
  4. nafonso

    nafonso

    Joined:
    Aug 10, 2006
    Posts:
    377
    Yes, its "awkward" since it supports byte[] :p

    By the way, in the docs there's no mention to it being able to send byte[] (http://unity3d.com/support/documentation/Components/net-RPCDetails.html, submitted bug report).

    It would be nice to support shorts too.
     
  5. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    Thanks for the tip, maybe a byte[1] would do ;)