Network.DestroyPlayerObjects 销毁玩家物体

static function DestroyPlayerObjects (playerID : NetworkPlayer) : void

Description描述

Destroy all the objects based on view IDs belonging to this player.

基于viewID销毁所有属于这个玩家的所有物体。

This should only be called when running as a server. It is, for example, meant to to clean up networked objects left by a disconnected player.

这个只能在服务器上调用。例如,清理一个已断开的玩家留下的网络物体。

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-4