- Home /
Multiplayer ID's?
I'm developing a network based multiplayer board game, and the major issue I'm currently having is being able to send RPC calls to specific players to essentially "enable" or "disable" their current turn.
I've researched the majority of the multiplayer examples out there but still have come up short on how to pull the internal multiplayer ID out for X player. My current build is essentially hot-seat playability, but that was never the overall goal of the project, so very lost at the moment.
Is there a way to RPC call player 2 specifically? Networkview? I've tried many things mostly resulting in errors in the compiler. Most multiplayer examples seem to be set up for all players being active at the same time (FPS,Racing,ect).
Any help on the command to pull a specific player ID would be extremely appreciated!
Answer by Flaeor · Feb 27, 2011 at 08:11 PM
I just took a few hours to try to solve this problem, and I believe I found the answer here: http://unity3d.com/support/documentation/ScriptReference/NetworkPlayer.html in the function ToString. This was not immediately obvious, as it seemed like it would be a variable called playerID or something. More importantly, it was impossible to search the scripting reference for because there are a million ToString functions. This is the code I used to test this function on the client:
void OnConnectedToServer() {
print("Player ID is " + Network.player.ToString());
}
This should also be helpful, as it returns an array of NetworkPlayers based on this playerID I just helped you find: http://unity3d.com/support/documentation/ScriptReference/Network-connections.html
Your answer
Follow this Question
Related Questions
Setting up invisibility for a turn-based JRPG style multiplayer game 0 Answers
Unity networking tutorial? 6 Answers
Issue with GPGS TurnBased.CreateQuickMatch() in unity 0 Answers
turn based two player bord game 0 Answers
Authoritative server basics Unity 5.2 0 Answers