API

Timer

Primary Variables

timerState

Controls if the timer is Counting or Disabled.

timerType

Controls if the timer will count-up, count-down, or count-up infinitely.

startTime

Time the timer will start from.

finishTime

Time the timer will stop at.

timerSpeed

Rate at which the timer adds or subtracts time.

loop

Timer will auto restart when complete.

useSystemTime

Timer will run as a clock and output system time.

timesUpEvent

A UnityEvent that can trigger custom scripting functions when time is up.

setZeroTimescale

Sets Time.timescale to 0 when time is up.

textType

Assign a default Unity UI Text or Text Mesh Pro UGUI component.

timerTextDefault

Assign a UI Text component to output a formatted string.

timerTextTMPUGUI

Assign a Text Mesh Pro UGUI component to output a formatted string.

displayOptions

Toggle specific time value fields in the output string.

leadingZero

Toggle the leading zero on specific time value fields in the output string.

Time Events

Create a list of custom events, the timer will trigger when the assigned time is reached.

eventName

The name of the custom time event.

eventTime

The time the event will be triggered.

timeEvent

The event that's invoked when the event time is reached.

Methods

AddTime(double)

Adds the value to the timer value, use a negative value to subtract time.

ClampGameTime

Clamps the timer value to ensure it does not exceed the max double value of 922337193600.

GetTimerValue

Returns the timer value as a double.

SetTimerValue(double)

Set timer to the value.

StartTimer

Sets the timer state to counting.

StopTimer

Sets the timer state to disabled.

UpdateUIText

Updates the assigned text component to display the current formatted time string.

ResetTimer

Sets the timer value to start time.

RestartTimer

Sets the timer value to start time, and starts the timer if it's not running.

Last updated