- Home /
Adding to list in RPC
Why will the following RPC function always replace instead of add objects to the list? Both server and client will have the same listOfPlayers
with the Count
of 1.
[RPC]
private void CreatePlayerSlot()
{
NetworkUser tempPlayer = new NetworkUser(); // create player
tempPlayer.netID = Guid.NewGuid(); // unique identifier
tempPlayer.ready = false; // player is ready or not
tempPlayer.active = false; // occupied or not
listOfPlayers.Add(tempPlayer);
}
I call this one everytime a player creates or joins a game.
Comment
Best Answer
Answer by jenci1990 · Dec 01, 2014 at 01:52 AM
void OnPlayerConnected(NetworkPlayer player) {
networkView.RPC("CreatePlayerSlot", RPCMode.AllBuffered);
}
Your answer
Follow this Question
Related Questions
RPC replace the existing list on all players 0 Answers
A node in a childnode? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to null-reference check a Collider2D that's been destroyed 1 Answer