ViewID に関連付けられたオブジェクトを破棄します
オブジェクトがローカルとリモートの両方で破棄されます。
オブジェクトや NetworkViewID に関連付けられた RPC は削除されませんのでご注意ください。
これらの削除は Network.RemoveRPCs によって明示的に行う必要があります。
var timer : float = 0;
function Awake () {
timer = Time.time;
}
// Network destroy the object which has this script
// it must have a NetworkView attached
function Update() {
if (Time.time - timer > 2) {
Network.Destroy(GetComponent.<NetworkView>().viewID);
}
}
using UnityEngine; using System.Collections;
public class ExampleClass : 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
function Update() {
if (Time.time - timer > 2) {
Network.Destroy(gameObject);
}
}
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public float timer = 0; void Awake() { timer = Time.time; } void Update() { if (Time.time - timer > 2) Network.Destroy(gameObject); } }