mirror of
https://github.com/kuhyx/praca_magisterska.git
synced 2026-07-04 15:43:14 +02:00
22 lines
344 B
C#
22 lines
344 B
C#
using UnityEngine;
|
|
|
|
public class AutoDestroy : MonoBehaviour
|
|
{
|
|
[SerializeField] private float lifetime = 1.5f;
|
|
|
|
private void OnEnable()
|
|
{
|
|
Invoke(nameof(DestroySelf), lifetime);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
CancelInvoke();
|
|
}
|
|
|
|
private void DestroySelf()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|