Network.peerType 端类型

static var peerType : NetworkPeerType

Description描述

The status of the peer type, i.e. if it is disconnected, connecting, server or client.

端类型的状态,即disconnected, connecting, server 或 client四种。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnGUI() {
		if (Network.peerType == NetworkPeerType.Disconnected)
			GUILayout.Label("Not Connected");
		else
			if (Network.peerType == NetworkPeerType.Connecting)
				GUILayout.Label("Connecting");
			else
				GUILayout.Label("Network started");
	}
}
function OnGUI() {
	if (Network.peerType == NetworkPeerType.Disconnected)
		GUILayout.Label("Not Connected");
	else if (Network.peerType == NetworkPeerType.Connecting)
		GUILayout.Label("Connecting");
	else
		GUILayout.Label("Network started");
}
最后修改:2011年5月17日 Tuesday 3:39

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。