Question by
NocSchecter · Jun 19, 2018 at 09:36 PM ·
c#androidnetworkingvrserver
Send variables from client to server
Hi all, I want the server to receive information from the customer's battery
this code is for client and server:
public class BatteryInfo : NetworkBehaviour
{
public float valorBateria;
private void Update()
{
if (!isServer)
{
valorBateria = (SystemInfo.batteryLevel) * 100;
CmdSendBatteryValue(valorBateria);
}
}
[Command]
public void CmdSendBatteryValue(float b)
{
valorBateria = b;
}
}
when I run the client and server, the client gets the data from the battery but the server receives nothing. Am I using the command and ClientRpc wrong? I am using Unity 2017.
Comment