title: Unity Networking Lobby : Set player name
body: <p>I work on my Networking Lobby of my 2D Game and I have a little issue with the name of my player :</p>
  
  <p>I downloaded <a href="https://www.assetstore.unity3d.com/en/#!/content/41836" rel="nofollow noreferrer">this example</a> to help me</p>
  
  <p>But as you can see, the name of the player can be changed when you have join the game and you entered in the lobby.</p>
  
  <p>But in my project, I want to write my name, click on Valid, and connect to the lobby. Like that :</p>
  
  <p><a href="https://i.stack.imgur.com/IAzUI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IAzUI.png" alt="enter image description here"></a></p>
  
  <p>My problem is I don't know how can I use my InputField text as name for my player in my Lobby.</p>
  
  <p>I try to save the name in a static Class with static property, but every players have the same name.</p>
  
  <p>This is my code :</p>
  
  <pre><code>//Attached to my Name Panel
  public class LobbyName : MonoBehaviour
  {
      public LobbyManager LobbyManager;
      public Text TxtName;
  
      public void OnClickValidName()
      {
          Constants.PlayerName = TxtName.text;
  
          LobbyManager.ChangeTo(LobbyManager.MenuLobby);
      }
  }
  
  //Attached to my canvas
  public class LobbyManager : NetworkLobbyManager
  {
      public Button BackButton;
  
      private RectTransform _currentPanel;
      public RectTransform ListLobby;
      public RectTransform MenuLobby;
      public RectTransform NameLobby;
  
      public string PlayerName { get; set; }
  
      private void Start()
      {
          _currentPanel = NameLobby; 
  
          NameLobby.gameObject.SetActive(true);
      }
  
      public void ChangeTo(RectTransform newPanel)
      {
          if (_currentPanel != null)
              _currentPanel.gameObject.SetActive(false);
  
          if (newPanel != null)
              newPanel.gameObject.SetActive(true);
  
          _currentPanel = newPanel;
      }
  }
  
  //Attached to my Player Item
  public class LobbyPlayer : NetworkLobbyPlayer
  {
      public Text TxtPlayerName;
  
      public string PlayerName = "";
  
      public override void OnClientEnterLobby()
      {
          base.OnClientEnterLobby();
  
          TxtPlayerName.text = Constants.PlayerName;
  
          LobbyPlayerList.Instance.AddPlayer(this);
      }
  }
  
  //Attached to my Menu lobby panel
  public class LobbyMenu : MonoBehaviour
  {
      public LobbyManager LobbyManager; 
  
      public void OnClickConnect()
      {
          LobbyManager.StartClient();
  
          LobbyManager.ChangeTo(LobbyManager.ListLobby); 
      }
  }
  </code></pre>
  
  <p>I know my static class not working because I have just ONE instance.</p>
  
  <p>(In the asset example, the playerName can be changed in the lobby panel, but I don't want the same configuration)</p>
  
  <p>Can you help me ?</p>
  
  <p>Thanks</p>