19 lines
349 B
C#
19 lines
349 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class SelfDestroy : MonoBehaviour {
|
|
private float startTime;
|
|
public float Delay = 1;
|
|
// Use this for initialization
|
|
void Start () {
|
|
startTime = Time.time;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
if (Time.time >= startTime + Delay) {
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|