- Home /
Changing the UI text value from server to Client side
I'm new to Unity to be honest so this may be simple for some of you I bet. So... I have a very simple scoring system in very simple football game. I store the score in 2 variables and they get written into to UI text objects. It works fine on the server, however on the client side nothing happens, the text value won't change at all. The client however receives the variables and their correct values but I just can't seem to have any success with those text gameobjects. The last method I tried was refreshing the text by using 2 separate functions like this:
[ClientRpc]
public void RpcScoreUpdate(int Player1Score)
{
Player1ScoreText.text = ("Score: "+ gameController.Player1Score.ToString());
}
[ClientRpc]
public void RpcScoreUpdate(int Player2Score)
{
Player2ScoreText.text = ("Score: "+ gameController.Player2Score.ToString());
}
Can anybody please write just a basic code for my network manager script that actually works for me? Many thanks guys!
i have the same problem. In server side everything is O$$anonymous$$. but in client side nothing sent!
I tested this for client side:
[Command]
public void CmdScoreUpdate(int Player1Score)
{
Player1ScoreText.text = ("Score: "+ gameController.Player1Score.ToString());
}
[Command]
public void CmdScoreUpdate(int Player2Score)
{
Player2ScoreText.text = ("Score: "+ gameController.Player2Score.ToString());
}
what is the problem. please help!
Your answer
Follow this Question
Related Questions
Unity UI: Text Adventure 2 Answers
Get Overflow Text 2 Answers
How to edit UI Text from script 3 Answers
Missing or garbled text in UI.Text 0 Answers
How to measure the width of a string? 0 Answers