如何在客户端连接到服务器时,我的foreach正在工作。因为当我把foreach放在Update中时,工作得很好。有什么问题?
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 ();
}
}
}