Network.OnPlayerDisconnected 当玩家断开

function OnPlayerDisconnected (player : NetworkPlayer) : void

Description描述

Called on the server whenever a player is 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年4月1日 Friday 20:51

本脚本参考基于Unity 3.4.1f5

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