using UnityEngine; namespace Utils { /// /// https://garry.tv/timesince /// /// /// Do something after 10 seconds. /// /// TimeSince ts; /// void Start() => ts = 0; /// void Update() /// { /// if (ts > 10) /// Something(); /// } /// /// public struct TimeSince { private float time; public static implicit operator float(TimeSince ts) => Time.time - ts.time; public static implicit operator TimeSince(float ts) => new() { time = Time.time - ts }; } }