It seems that all tutorials and even the unity documentation are out of date because SycVars for me are not working as demonstrated by them. I have the script ClientManager:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class ClientManager : NetworkBehaviour {
[SyncVar]
public static int numOfConnectedClients;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
Here is a picture of the error (In the bottom left hand corner):
If I comment out the [SyncVar], the error stops, so it is definately the culprit.
Are SyncVars unuseable now? If so what’s the alternative to make sure all clients are informed of the change of a specific variable?