Hello, i have 2 questions about unity networking. First based on this script:
function OnSerializeNetworkView (stream : BitStream, info : NetworkMessageInfo) {
var horizontalInput : float = 0.0;
if (stream.isWriting) {
// Sending
horizontalInput = Input.GetAxis (“Horizontal”);
stream.Serialize (horizontalInput);
} else {
// Receiving
stream.Serialize (horizontalInput);
// … do something meaningful with the received variable
}
}
it means that stream.Serialize() sends and writes data from/to a variable like horizonralInput? Also in Scripting Referance there is not stream, only Bitstream.
Second: how do i use RPCs? I read this:
// All RPC calls need the @RPC attribute!
@RPC
function PrintText (text : String)
{
Debug.Log(text);
}
so if i want the game to call this function at a client how can i do it?