Multiplayer Usernames c#

I’m having a lot of trouble synchronizing a player’s username to the other player. At the start of my game, they are asked to give their self a username that will be used for that session and it stores it in a PlayerStats script that is on an empty game object. When a player joins a lobby(maximum of 2 players), their lobby name is set by the username that is in the PlayerStats script. I need to find a way to get the other player’s username to store it a LobbyHandler string.

alt text


LobbyHandler script -

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class LobbyHandler : MonoBehaviour {
	public string playerName;
	public Text playerOneName;
	public Text playerTwoName;
	public bool isLobbyPlayerOne;
	public bool isLobbyPlayerTwo;
	public GameObject Scripts;

	public string playerOneNameString;
	public string playerTwoNameString;
	void Awake () {
		Scripts = GameObject.Find("_Scripts");
		playerOneName.text = "<Loading>";
		playerTwoName.text = "<Waiting>";
	}
	void Start () {
		playerName = GameObject.Find("_Scripts").GetComponent<PlayerStats>().Username;
	}
	[RPC] void OnPlayerConnected(NetworkPlayer player) {
		StartCoroutine(SetLobbyStats());
		ConsoleLog.Instance.Log(playerName + " joined.");
	}
	public void SetLobbyStatsFunction () {
		StartCoroutine(SetLobbyStats());
	}
	[RPC] IEnumerator SetLobbyStats () {
		yield return new WaitForSeconds(1);
		if (Scripts.GetComponent<PlayerStats> ().isPlayerOne == true) {
			isLobbyPlayerOne = true;
			isLobbyPlayerTwo = false;
			AssignPlayerOne();
			UpdatePlayerNames();
		} else {
			isLobbyPlayerOne = false;
			AssignPlayerTwo();
			isLobbyPlayerTwo = true;
			UpdatePlayerNames();
		}
	}
	[RPC] void UpdatePlayerNames() {
		//
	}

	[RPC] void AssignPlayerOne () {
		playerOneNameString = Scripts.GetComponent<PlayerStats>().Username;
		playerOneName.text = Scripts.GetComponent<PlayerStats>().Username;
	}

	[RPC] void AssignPlayerTwo () {
		playerTwoNameString = Scripts.GetComponent<PlayerStats>().Username;
		playerTwoName.text = Scripts.GetComponent<PlayerStats>().Username;
	}
}

PlayerStats Script -

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class PlayerStats : MonoBehaviour {

	public string Username = "Unassigned";
	public bool isPlayerOne = false;
	public bool isPlayerTwo = false;

	public void CheckUsername () {
		if (Username == "") {
			Username = "Unassigned";
		}
	}
}

When you are calling RPC methods, you should be using NetworkView.RPC.

networkView.RPC("AssignPlayerTwo", RPCMode.AllBuffered, viewID, transform.position);

You need to set your code up so that the RPC methods are being called by NetworkView.RPC.