Skip to main content

Class NumericValueDisplay

Displays a formatted numeric value in a TextMeshPro UI element and controls its visibility.

public class NumericValueDisplay : MonoBehaviour

Inheritance​

Remarks​

Used primarily as a countdown timer driven by TrafficSignalMixer — when a traffic-light clip has IndicateTime enabled, the remaining clip duration is pushed here each frame so participants can see how long until the signal changes. The configurable stringFormat field lets designers control decimal precision per light without code.

Methods​

SetValue(float)​

Sets the numeric value to be displayed in the text component using the configured format string.

public void SetValue(float value)

Parameters​

NameTypeDescription
valuefloatThe numeric value to display.

SetValue(float, string)​

Sets the numeric value to be displayed in the text component using a provided format string.

public void SetValue(float value, string customFormat)

Parameters​

NameTypeDescription
valuefloatThe numeric value to display.
customFormatstringThe format string used to convert the value into a text representation.

SetVisible(bool)​

Shows or hides the text component based on the specified visibility.

public void SetVisible(bool isVisible)

Parameters​

NameTypeDescription
isVisibleboolTrue to show the component, false to hide it.