Aetheria/Assets/Scripts/Gameplay/TimedDestroy.cs

19 lines
312 B
C#
Raw Normal View History

using System;
using UnityEngine;
public class TimedDestroy : MonoBehaviour
{
public float Duration;
private float _startTime;
private void Start()
{
_startTime = Time.time;
}
public void Update()
{
if(Time.time - _startTime > Duration) Destroy(gameObject);
}
}