At the moment I am trying to run a command on my server to deliver a new player Number from the Server. I do not want to use networkPlayer because the numbers should be limited to 8. (networkPlayer counts on)
If i run the following code I get the output of the Debug.Log on in the Debug Window without beeing a server. Shouldn’t I just get the output if this would be the server?
CentralAccess.m_lobby.networkView.RPC("RPC_RequestPlayerNumber", RPCMode.Server, _player);
[RPC]
public void RPC_RequestPlayerNumber(NetworkPlayer _networkPlayer)
{
int playerNumber = 0;
m_lobbyPlayers.ToList().ForEach(o => Debug.LogError(o.m_number));
for (int i = 1; i < m_lobbyPlayers.Length + 1; ++i)
{
Debug.LogError(i);
if (!m_lobbyPlayers.Any(o => o.m_number == i))
{
playerNumber = i;
break;
}
}
Debug.LogWarning(Network.player);
Debug.LogError(playerNumber);
networkView.RPC("RPC_CreatePlayer", RPCMode.AllBuffered, playerNumber);
Debug.LogError(_networkPlayer);
networkView.RPC("RPC_SetPlayerNumber", RPCMode.AllBuffered,_networkPlayer, playerNumber);
}