Table of Contents

Class Timer

Namespace
UILib.Behaviours
Assembly
UILib.dll

Runs a timer.

public class Timer : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
Timer
Derived
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.Internal_CancelInvokeAll(MonoBehaviour)
MonoBehaviour.Internal_IsInvokingAll(MonoBehaviour)
MonoBehaviour.IsObjectMonoBehaviour(Object)
MonoBehaviour.StopCoroutineManaged(Coroutine)
MonoBehaviour.GetScriptClassName()
MonoBehaviour.useGUILayout
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.transform
Component.gameObject
Component.tag
Object.m_CachedPtr
Object.OffsetOfInstanceIDInCPlusPlusObject
Object.objectIsNullMessage
Object.cloneDestroyedMessage
Object.GetInstanceID()
Object.GetHashCode()
Object.CompareBaseObjects(Object, Object)
Object.EnsureRunningOnMainThread()
Object.IsNativeObjectAlive(Object)
Object.GetCachedPtr()
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectOfType<T>()
Object.ToString()
Object.GetOffsetOfInstanceIDInCPlusPlusObject()
Object.CurrentThreadIsMainThread()
Object.Internal_CloneSingle(Object)
Object.Internal_InstantiateSingle(Object, Vector3, Quaternion)
Object.Internal_InstantiateSingleWithParent(Object, Transform, Vector3, Quaternion)
Object.ToString(Object)
Object.GetName(Object)
Object.IsPersistent(Object)
Object.Internal_InstantiateSingle_Injected(Object, ref Vector3, ref Quaternion)
Object.Internal_InstantiateSingleWithParent_Injected(Object, Transform, ref Vector3, ref Quaternion)
Object.name
Object.hideFlags

Properties

onEnd

Invokes listeners when the timer finishes.

public UnityEvent onEnd { get; }

Property Value

UnityEvent

onIter

Invokes listeners on each iteration of the timer. The value passed to listeners is the current value of the timer.

public ValueEvent<float> onIter { get; }

Property Value

ValueEvent<float>

onStart

Invokes listeners whenever the timer is started.

public UnityEvent onStart { get; }

Property Value

UnityEvent

paused

Whether the timer should pause.

public bool paused { get; }

Property Value

bool

running

Whether the timer coroutine is currently running.

public bool running { get; }

Property Value

bool

timeScale

The time scale. By default this is 1. Scales how quickly the timer should run.

The higher this value, the faster the timer runs. The lower this value, the slower the timer runs.

public float timeScale { get; }

Property Value

float

timer

The current value of the timer.

public float timer { get; }

Property Value

float

Methods

PauseTimer(bool)

Pauses the timer.

If the timer is paused, the internal timer will no longer decrease, and any onIter listeners will no longer be invoked. Passing false will allow the timer to continue normal execution.

public void PauseTimer(bool pause = true)

Parameters

pause bool

Whether the timer should be paused

ReverseTimer()

Sets the timer to go in reverse of its current direction.

public void ReverseTimer()

SetTimeScale(float)

Sets the timeScale.

public void SetTimeScale(float timeScale)

Parameters

timeScale float

StartTimer(float, float)

Starts the timer. If the timer is already running, this will restart it.

Both the start and end time must be >= 0.

public void StartTimer(float startTime, float endTime = 0)

Parameters

startTime float

What time the timer should start at

endTime float

What time the timer should end at

StopTimer()

Stops the timer immediately.

public void StopTimer()