Status Effect Timers
🔥
3
With this addon, your buffs/debuffs will now show a timer on when they’re expiring!
- Start by going into the
ITemporalEffect.csand add these 2 properties:
public float remainingDuration { get; }
public bool hasFiniteDuration { get; }
- Go into the
ATemporalEffect.csscript and add these two properties:
public float remainingDuration => m_temporalData.remainingDuration;
public bool hasFiniteDuration => !float.IsPositiveInfinity(m_temporalData.remainingDuration);
and also make sure Update() only counts down finite effects
public void Update()
{
Debug.Assert(m_effectData.initialized, "Effect must be initialized before updating.");
if (!float.IsPositiveInfinity(m_temporalData.remainingDuration))
{
m_temporalData.remainingDuration = math.max(0.0f, m_temporalData.remainingDuration - Time.deltaTime);
}
OnUpdate();
}
- Go into the
UIEffectIconscript and add these two properties:
public Image iconImage => m_icon;
public RectTransform iconRectTransform => m_icon != null ? m_icon.rectTransform : transform as RectTransform;
Import the new script into your runtime folder that i have attached to this message
Go into your
UIHudEffectBarscript and add this insideOnTemporalEffectAdded(ITemporalEffect effect)
var timer = effectIcon.GetComponent<UIEffectIconDurationTimer_TD>();
if (timer != null)
{
timer.Unbind();
}
effectIcon.Hide();
DONE! no unity setup is needed
If you wanna modify the text thats counting down, change these values inside the UIEffectIconDurationTimer_TD script
[SerializeField] private float m_verticalOffset = 6f;
[SerializeField] private float m_textHeight = 16f;
[SerializeField] private float m_widthPadding = 8f;
[SerializeField] private float m_fallbackWidth = 64f;
[SerializeField] private float m_fallbackFontSize = 12f;
[SerializeField] private float m_referenceFontScale = 0.75f;

💬 Comments (1)
Want to continue the conversation?