Search Unity

Third Party Mirror does not work

Discussion in 'Multiplayer' 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;
    }
     
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Please check out our the Mirror/Examples folder & Documentation to get started :)