Search Unity

Third Party How to get text change in the server in Mirror in unity

Discussion in 'Multiplayer' started by yairk333, Jan 13, 2021.

  1. yairk333

    yairk333

    Joined:
    Mar 26, 2020
    Posts:
    23
    If I change the text from the game then the text does not change for everyone (it only changes for me) but they do see the text so I want them to see the text change, for example if it says "hi" at first I change the text from the game and then I see the text change But the other players do not see that the text has become a different word they still see hi so I want the other players to see that the text also changes
     
    Last edited: Jan 13, 2021
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'd probably use a Command to send the new text string to the server/host, which then sets it to a SyncVar. If Mirror supports Unet's SyncVar hook feature, use that to set the Text with the updated value of the SyncVar on the clients. If not, then just check every few seconds whether the SyncVar has changed on the client, and if so you use the value to set the Text. (You could check every frame, but my guess is you aren't going to change this Text super frequently and you'd tolerate a bit of a delay, so no sense in burning CPU checking every frame, but do it however often you like)