You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
598 B
C#

1 week ago
using UnityEngine;
namespace Unity.BossRoom.Utils
{
/// <summary>
/// Will Disable this game object once active after the delay duration has passed.
/// </summary>
public class SelfDisable : MonoBehaviour
{
[SerializeField]
float m_DisabledDelay;
float m_DisableTimestamp;
void Update()
{
if (Time.time >= m_DisableTimestamp)
{
gameObject.SetActive(false);
}
}
void OnEnable()
{
m_DisableTimestamp = Time.time + m_DisabledDelay;
}
}
}