Reading variables values assigned to prefabs spawned on network

Every player that spawns on the network gets a name assigned to them. How do I ensure that the name assigned to each player to visible to all players?

If I am using the code below, I can only see my name, but not the name assigned to other players who join in at different times during the game.

public void SetPlayerData()
    {
        if (IsOwner)
        {
            playerName.text = Bootstrap.instance.playerName;
            Debug.Log(Bootstrap.instance.playerName);
        }
    }

I’m new to NGO so the question so my question may sound very basic.

Hi @marzdh
You could use NetworkVariable for this situation.

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();
    }