Firstborn/Assets/RPG Creation Kit/Scripts/_ General/DestroyAfter.cs

26 lines
512 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RPGCreationKit
{
/// <summary>
/// Destroys a GameObject after X seconds.
/// </summary>
public class DestroyAfter : MonoBehaviour
{
[SerializeField] public float time = 0;
DestroyAfter(float time)
{
this.time = time;
}
// Update is called once per frame
void Start()
{
Destroy(this.gameObject, time);
}
}
}