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);
}
Page last updated: 2011-4-1