Hello.
I want sync each player’s score but it not work
this is my code
[SyncVar] public int p1_Bestscore = 0;
[SyncVar] public int p2_Bestscore = 0;
[SyncVar] public Text Maxscoretext;
[SyncVar] public Text enemy;
public override void OnStartServer()
{
base.OnStartServer();
Maxscoretext.text = p1_Bestscore.ToString();
Maxscoretext = GameObject.Find("Maxscore").GetComponent<Text>();
PlayerPrefs.GetInt("bestscore", p1_Bestscore);
enemy = GameObject.Find("enemyScore").GetComponent<Text>();
enemy.text = p2_Bestscore.ToString();
}
public override void OnStartClient()
{
base.OnStartClient();
Maxscoretext.text = p2_Bestscore.ToString();
Maxscoretext = GameObject.Find("Maxscore").GetComponent<Text>();
PlayerPrefs.GetInt("bestscore", p2_Bestscore);
enemy = GameObject.Find("enemyScore").GetComponent<Text>();
enemy.text = p1_Bestscore.ToString();
}
and error code is
UNetWeaver error: SyncVar [UnityEngine.UI.Text GameManager_Multi::Maxscoretext] from UnityEngine.UI.dll cannot be a different module.
UnityEngine.Debug:LogError(Object)
what is this error??