28 lines
547 B
C#
Raw Normal View History

2025-09-06 17:17:39 +04:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyTimer : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
startTime = Time.time;
}
// Update is called once per frame
void Update()
{
if (Time.time - startTime > duration)
{
Destroy(this.gameObject);
}
}
private float startTime;
[Tooltip("The length of time before this gameobject is destroyed")]
public float duration = 3.0f;
}