title: Unity Steamworks-Leaderboard
body: <p>I have created an ingame scoreboard, where i want you to be able to see the players who are connected to the server Steam username. So far i've created the scoreboard and everything, the only thing now is getting the steam username to show instead of my "player name goes here" text. I've tried several things but with no success :(</p>
  
  <p>This is the Scoreboard Script:</p>
  
  <pre><code>[SerializeField]
  GameObject playerScoreboardItem;
  
  [SerializeField]
  Transform playerScoreboardList;
  
  void OnEnable()
  {
      Player[] players = GameManager.GetAllPlayers();
  
      foreach(Player player in players)
      {
          GameObject itemGO = (GameObject)Instantiate(playerScoreboardItem, playerScoreboardList);
          PlayerScoreboardItem item = GetComponent&lt;PlayerScoreboardItem&gt;();
          if(item != null)
          {
              item.Setup(SteamFriends.GetPersonaName());
          }
      }
  }
  
  void OnDisable()
  {
      foreach(Transform child in playerScoreboardList)
      {
          Destroy(child.gameObject);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And this is the ScoreboardItem Script:</p>
  
  <pre><code>    [SerializeField]
  Text usernameText;
  
  public void Setup(string username)
  {
      usernameText.text = SteamFriends.GetPersonaName();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And the last script:</p>
  
  <pre><code>            string username = SteamFriends.GetPersonaName();
  
          CmdSetUsername(transform.name, username);
      }
  
      GetComponent&lt;Player&gt;().Setup();
  }
  
  [Command]
  void CmdSetUsername (string playerID, string username)
  {
      Player player = GameManager.GetPlayer(playerID);
      if(player == null)
      {
          Debug.Log(SteamFriends.GetPersonaName() + "joined!");
          player.username = SteamFriends.GetPersonaName();
      }
  }
  </code></pre>