20 lines
341 B
C#
20 lines
341 B
C#
|
using System.Collections;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class TimedDestructor : MonoBehaviour
|
||
|
{
|
||
|
[SerializeField]
|
||
|
private float lifeTime = 1f;
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
StartCoroutine(DoDestroyCountdown());
|
||
|
}
|
||
|
|
||
|
private IEnumerator DoDestroyCountdown()
|
||
|
{
|
||
|
yield return new WaitForSeconds(lifeTime);
|
||
|
Object.Destroy(base.gameObject);
|
||
|
}
|
||
|
}
|