MonoBehaviour.OnPlayerDisconnected 当玩家断开连接

function OnPlayerDisconnected (player : NetworkPlayer) : void

Description描述

Called on the server whenever a player disconnected from the server.

当一个玩家从服务器上断开时在服务器端调用。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnPlayerDisconnected(NetworkPlayer player) {
		Debug.Log("Clean up after player " + player);
		Network.RemoveRPCs (player);
		Network.DestroyPlayerObjects (player);
	}
}
function OnPlayerDisconnected(player : NetworkPlayer ) {
	Debug.Log ("Clean up after player " +  player);
	Network.RemoveRPCs (player);
	Network.DestroyPlayerObjects (player);
}
最后修改:2011年1月2日 Sunday 18:25

本脚本参考基于Unity 3.4.1f5

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