How to pass values between networked players?

I have a game set up with three players connected using MasterServer, but now I want to access values from other players, for example, I want each player to be a different character, so I want to limit each player’s choice based on other players’ choices.

My initial thought was seeing if there is a way to access static variables by doing something like Network.Connections[0].character but there doesn’t seem to be a way to do that.

Another idea was to create a game object with a name that matches that character’s name whenever a player chooses a character so I could use GameObject.Find to see if that object exists and therefore has been selected, but that seems like a hacky way to do it.

Lastly I’ve looked into Remote Procedure Calls, but I haven’t got my head round that yet. if that’s the way to go, I can update this or ask a new question with more details.

When you create you prefab for the character have it register itself in a list of the current characters.

  using System.Collections.Generic;
  using System.Linq;

  ...

  public static List<Player> players = new List<Player>();

  void Awake() {
       players.Add(this);
  }

  void OnDestroy() {
      players.Remove(this);
  }

Then you need to RPC when a player selects a name

  public string name;

 bool NameSelected(string newName) {
        if(players.Any(p=>p.name == newName)) {
              return false; //Name not available
        }
        networkView.RPC("SetName", RPCMode.All, newName);
        return true;
 }

 [RPC]
 void SetName(string newName) {
      name = newName;
 }