I can not get this to work for the life of me. I’ve tried everything and it will not update to the clients. Thanks in advance.
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using UnityEngine.UI;
public class ConnectedClients : NetworkBehaviour {
public Text connectedClientsText;
public Network network;
[SyncVar]
public int connectedClients;
void Update(){
if (isServer) {
connectedClients = network.connectedClients;
}
else {
connectedClientsText.text = "Connected Clients: " + connectedClients.ToString ();
}
}
}