26 lines
468 B
C#
26 lines
468 B
C#
using UnityEngine;
|
|
using UnityEngine.VFX;
|
|
|
|
public class DisableVFXWhenDone : MonoBehaviour
|
|
{
|
|
public float delay = 0.1f;
|
|
|
|
private VisualEffect vfx;
|
|
|
|
private float startTime;
|
|
|
|
private void OnEnable()
|
|
{
|
|
vfx = GetComponent<VisualEffect>();
|
|
startTime = Time.realtimeSinceStartup;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Time.realtimeSinceStartup - startTime >= delay && vfx != null && !vfx.HasAnySystemAwake())
|
|
{
|
|
base.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
}
|