Skip to main content

DelayedEvent

A class in Root.Township, the global namespace.

Fires a UnityEvent after a delay, either on start or when Invoke is called (for example from another UnityEvent).

Constructors​

MemberWhat it is
DelayedEvent()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private UnityEvent delayedEventThe event to fire.
private float durationDelay in seconds; 0 or less fires straight away.
private bool isInvokedOnStartWhether to start the delay as soon as the object starts.

Methods​

MemberWhat it is
void Invoke()Fires delayedEvent after duration seconds, or straight away if the duration is 0.
2 private and internal methods
MemberWhat it is
private void Start()Calls Invoke if isInvokedOnStart is set.
private IEnumerator TriggerEvent() (iterator)Waits duration seconds and fires the event.