Search Unity

Trouble with RPC

Discussion in 'Multiplayer' started by Deleted User, Jan 30, 2010.

  1. Deleted User

    Deleted User

    Guest

    Ok i understand how an rpc is sent but how the hell do you read it on a client and on the server?

    so far htis is what i have,
    Code (csharp):
    1.  
    2.     void SendMSG(string msg)
    3.     {
    4.         Debug.Log("Sending msg: " + msg);
    5.         NetworkViewID VID = Network.AllocateViewID();
    6.         networkView.RPC("SendRpcMsg",RPCMode.AllBuffered, VID , msg);
    7.         Debug.Log("Msg sent");
    8.     }
    9.  
    10.     [RPC]
    11.     void SendRpcMsg(NetworkViewID ID, string msg)
    12.     {
    13.         string RpcMsg = msg;
    14.         Debug.Log("Msg = "+ msg);
    15.     }
    16.  
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Are you getting any error messages wihen you try to use this?
     
  3. Deleted User

    Deleted User

    Guest

    no i found out from a sample you just get the value that was sent via the function itself/