Doesn’t seem to be working with Network Variables. The name set for the host is also set for the clients. Also, only the hostcansee the name, the clients can’t. Maybe I am doing it incorrectly.
private NetworkVariable<FixedString128Bytes> m_SomeValue = new("", NetworkVariableReadPermission.Everyone);
public override void OnNetworkSpawn() {
base.OnNetworkSpawn();
SetPlayerData();
if (!IsServer) m_SomeValue.OnValueChanged += NameChanged;
}
//Changes the name on the server
public void SetPlayerData()
{
m_SomeValue.Value = Bootstrap.instance.playerName;
playerName.text = m_SomeValue.Value.toString();
}
//Changes the name for each client and display to everyone
private void NameChanged(FixedString128Bytes previousValue, FixedString128Bytes newValue)
{
playerName.text = newValue.toString();
}