Search Unity

Bug Name Multiplayer

Discussion in 'Immediate Mode GUI (IMGUI)' started by Ze1ro, Dec 21, 2022.

  1. Ze1ro

    Ze1ro

    Joined:
    Jul 28, 2022
    Posts:
    8
    The problem is that when the player enters and takes his name, it does not appear to the other player
    The code I used

    Use Mirror:

    [SyncVar(hook = nameof(SetColor))]
    public string name;
    public TMP_Text nametext;
    void SetColor(string _, string newColor)
    {
    userFName = name;

    nametext = GetComponentInChildren<TMP_Text>();
    nametext.text = newColor;

    }
    public override void OnStartServer()
    {
    base.OnStartServer();
    userFName = MssqlConnection.user.userLName;
    Debug.Log(name);
    nametext.text = userFName;
    }