Network.isServer 是否服务器

static var isServer : bool

Description描述

Returns true if your peer type is server.

如果端点类型是服务器,返回true。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void OnGUI() {

		if (Network.isServer)

			GUILayout.Label("Running as a server");

		else

			if (Network.isClient)

				GUILayout.Label("Running as a client");



	}

}
function OnGUI() {

	if (Network.isServer)

		GUILayout.Label("Running as a server");

	else if (Network.isClient)

		GUILayout.Label("Running as a client");

}
Page last updated: 2011-4-2