当客户端连接到服务器时,请执行UNET

时间:2016-07-19 09:16:11

标签: c# unity5 unity3d-unet

如何在客户端连接到服务器时,我的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 ();
        }
    }

}

0 个答案:

没有答案