Network
- AllocateViewID
- CloseConnection
- connections
- connectionTesterIP
- connectionTesterPort
- Connect
- DestroyPlayerObjects
- Destroy
- Disconnect
- GetAveragePing
- GetLastPing
- HavePublicAddress
- incomingPassword
- InitializeSecurity
- InitializeServer
- Instantiate
- isClient
- isMessageQueueRunning
- isServer
- logLevel
- maxConnections
- minimumAllocatableViewIDs
- natFacilitatorIP
- natFacilitatorPort
- OnConnectedToServer
- OnDisconnectedFromServer
- OnFailedToConnectToM...
- OnFailedToConnect
- OnNetworkInstantiate
- OnPlayerConnected
- OnPlayerDisconnected
- OnSerializeNetworkView
- OnServerInitialized
- peerType
- player
- proxyIP
- proxyPassword
- proxyPort
- RemoveRPCsInGroup
- RemoveRPCs
- sendRate
- SetLevelPrefix
- SetReceivingEnabled
- SetSendingEnabled
- TestConnectionNAT
- TestConnection
- time
- useProxy
Network.Destroy 销毁
static function Destroy (viewID : NetworkViewID) : void
Description描述
Destroy the object associated with this view ID across the network.
跨网络销毁与该viewID相关的物体。
The object is destroyed locally and remotely.
本地的和远端的都会被销毁。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float timer = 0;
void Awake() {
timer = Time.time;
}
void Update() {
if (Time.time - timer > 2)
Network.Destroy(GetComponent<NetworkView>().viewID);
}
}
var timer : float = 0;
function Awake () {
timer = Time.time;
}
// Network destroy the object which has this script
// it must have a NetworkView attached
//通过网络销毁拥有该脚本的物体,必须具备NetworkView属性
function Update() {
if (Time.time - timer > 2) {
Network.Destroy(GetComponent(NetworkView).viewID);
}
}
• static function Destroy (gameObject : GameObject) : void
Description描述
Destroy the object across the network.
跨网络销毁该物体。
The object is destroyed locally and remotely.
本地的和远端的都会被销毁。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float timer = 0;
void Awake() {
timer = Time.time;
}
void Update() {
if (Time.time - timer > 2)
Network.Destroy(gameObject);
}
}
最后修改:2011年4月4日 Monday 16:09