I have tried everything I could and wasted a lot of time on this very worthless topic but I still dont get why this doesnt work… The client updates the value and it does not sync to the editor (who is hosting) where the value is still the default one (-1).
[SyncVar]
public int survivorID = -1; //Starts from 1...
public override void OnStartLocalPlayer()
{
if (!isLocalPlayer)
{
return;
}
killer = FindObjectOfType<Killer>();
StartCoroutine(SettingSurvIDs());
}
IEnumerator SettingSurvIDs()
{
yield return new WaitForSeconds(0.3f);
CmdSetSurvivorID();
}
[Command]
void CmdSetSurvivorID()
{
survivorID = int.Parse(netId.ToString()) - (int.Parse(killer.numberOfSurvivors.ToString())+2);
}
EDIT : I am well aware that I don’t need to add the islocalplayer check there but as I said I’m trying everything that I can