BeardedManStudios.Network.NetworkingManager.PollPlayerList C# (CSharp) Method

PollPlayerList() public method

Get the latest list of players from the server
public PollPlayerList ( Action callback = null ) : void
callback Action The method to call once the player list has been received
return void
		public void PollPlayerList(Action<List<NetworkingPlayer>> callback = null)
		{
			if (OwningNetWorker.IsServer)
			{
				if (callback != null)
				{
					List<NetworkingPlayer> tmp = new List<NetworkingPlayer>(OwningNetWorker.Players.ToArray());
					tmp.Insert(0, OwningNetWorker.Me);
					callback(tmp);
				}

				return;
			}

			pollPlayersCallback = callback;
			RPC("PollPlayers", NetworkReceivers.Server);
		}