This prefab allows you to configure timers that can output the current time as a formatted string to UI Text components and trigger a time’s up events – the available inspector options will be different depending on which settings are selected so that only relevant options are visible.
The primary options used to control a timer’s core functionality – the available options will be different depending on which Timer Type is selected.
Timer Options – Properties
|Timer State||Toggle between either a counting or disabled state.|
|Timer Type||Count up, count down, or count up infinite.|
|Set Start Time For Count Up||Allows the timer to start at a specific time when the timer is set to count up.|
|Start Time||Time to start the timer at when counting up and set start time for count up is enabled or when counting down.|
|Finish Time||Time to stop the timer at when the timer is set to count up.|
|Timer Speed||Timer speed multiplier allows the timer to run at an increased or decreased speed.|
|Use System Time||Timer will run as a clock and output system time.|
Time’s Up Event Options
When the timer is counting up or counting down and reaches it’s ending time, a UnityEvent is triggered. This event allows you to configure a timer to trigger any action on other objects or components in your scene – the available options will be different depending on which Load Scene On type is selected.
Time’s Up Event Options – Properties
|Set Zero Timescale||Sets Time.timescale to 0, essentially pausing the game.|
|Time’s Up Event||A standard UnityEvent that can be configured from the inspector to trigger useful actions when time is up.|
|Destroy On Finish||Assign game objects to this array to have them destroyed when time’s up.|
|Load Scene On||Assign a scene name by string that will be loaded at a specific time or when time’s up – this scene must be added to the build settings.|
UI Text Output
The Timer component can output its current time as a formatted string to a default UI Text or Text Mesh Pro UGUI component – the available formatting options will be different depending on configured options.
UI Text Output – Properties
|Text Type||Assign a default Unity UI Text or Text Mesh Pro UGUI component.|
|Timer Text Default||Assign a default UI Text component for the timer to output a formatted string to.|
|Timer Text TMPUGUI||Assign a Text Mesh Pro UGUI UI Text component for the timer to output a formatted string to.|
|Timer Format||Toggle on or off specific time value fields in the output string.|
|Leading Zero||Toggle on or off the leading zero on specific time value fields in the output string.|