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");
}
Page last updated: 2011-5-17