How to make when a client connects to server, that my foreach is working. Because when I put the foreach in Update, it's working great. What's the problem?
using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
public class Net : NetworkManager {
public GameObject[] _mans;
void Update()
{
_mans = GameObject.FindGameObjectsWithTag ("Player");
Debug.Log (_mans.Length);
}
public override void OnClientConnect(NetworkConnection conn)
{
foreach (GameObject man in _mans)
{
man.GetComponent<UIManager> ().Play ();
}
}
}