指定した時間経過後に自爆

指定時間経過後に破壊する
using UnityEngine;
using System.Collections;
public class SelfDestroy : MonoBehaviour {
public GameObject effectPrefab;
void Start () {
Invoke("DestroyShell", 1.5f);
}
void DestroyShell(){
Destroy(gameObject);
Instantiate(effectPrefab, transform.position, Quaternion.identity);
}
}
Unity Code Memo
他のコースを見る
指定時間経過後に破壊する
using UnityEngine;
using System.Collections;
public class SelfDestroy : MonoBehaviour {
public GameObject effectPrefab;
void Start () {
Invoke("DestroyShell", 1.5f);
}
void DestroyShell(){
Destroy(gameObject);
Instantiate(effectPrefab, transform.position, Quaternion.identity);
}
}
指定した時間経過後に自爆