Files
EmeraidAI/Runtime/Scripts/Internal/EmeraldTimedDespawn.cs
2025-07-20 10:01:29 +08:00

24 lines
458 B
C#

using UnityEngine;
namespace EmeraldAI.Utility
{
public class EmeraldTimedDespawn : MonoBehaviour
{
public float SecondsToDespawn = 3;
float Timer;
void Update()
{
Timer += Time.deltaTime;
if (Timer >= SecondsToDespawn)
{
EmeraldObjectPool.Despawn(gameObject);
}
}
void OnDisable()
{
Timer = 0;
}
}
}