How to send input in an online game?

I’m trying to send each player’s input to the other players:

float verticalAxis = 0;

void Update () {
	readWS();
}

[RPC]
public void sendWS(float VerticalAxis)
{
	VerticalAxis = Input.GetAxisRaw("Vertical");
}

public void readWS()
{
	if(networkView.isMine != true)
	{
		networkView.RPC ("sendWS", RPCMode.All, verticalAxis);

		Debug.Log(verticalAxis);
	}
}

Could someone please tell me why this doesn’t work?

Before the second player joins the server, the debug doesn’t show anything. After the second player joins, it reads “0”. So it seems that the verticalAxis value isn’t being updated.

I’ve tested and Input.GetAxisRaw(“Vertical”) does give a correct value.

There are some major problems. The first one is what Lilbob mentioned. Let’s try this:

 float verticalAxis;

 void Update()
 {
     readWS();
 }

 [RPC]
 public void sendWS(float VerticalAxis)
 {
     // here everyone will execute the code because of AllBuffered
     // so simply change the value of the players with the new one

     transform.Rotate(0, VerticalAxis, 0); // I'm not sure how to do this properly :D
        
 }

 public void readWS()
 {
     verticalAxis = Input.GetAxisRaw("Vertical");   // read my axis value to send to the others

     if(networkView.isMine) // if I'm the locally controlled player then...
     {
         // ...I tell everyone in the room to execute the sendWS function
         // AllBuffered, because if someone joins later, he will get the
         // new data immediately from the server
         networkView.RPC ("sendWS", RPCMode.AllBuffered, verticalAxis);
     }
 }

The code is untested, so maybe it doesn’t work.