NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class DashLight

    Dashboard warning/indicator light that smoothly transitions between on and off states. Provides hold time and fade effects to prevent flickering and simulate physical bulb behavior. Works with Unity UI Image components.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    DashLight
    Namespace: NWH.VehiclePhysics2.VehicleGUI
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [RequireComponent(typeof(Image))]
    public class DashLight : MonoBehaviour

    Fields

    fadeTime

    Duration of the fade-out transition in seconds after holdTime expires. Simulates the gradual dimming of conventional incandescent bulbs. Set to 0 for instant off behavior (LED-style).

    Declaration
    [Tooltip("Time it takes for the light to turn off, once Hold Time expires. Imitates dash lights that use conventional bulbs.")]
    public float fadeTime
    Field Value
    Type Description
    float

    holdTime

    Duration in seconds to keep the light on after the Active state becomes false. Prevents flickering from rapidly changing signals like ABS or TCS activation. Recommended: 0.1-0.3 seconds for systems that toggle frequently.

    Declaration
    [Tooltip("Time it takes for the light to start turning off after the state has changed. Useful to remove flicker from signals that are not persistent but rather change on frame-to-frame basis, e.g. ABS and TCS. ")]
    public float holdTime
    Field Value
    Type Description
    float

    offColor

    Image color when the light is inactive. Typically black or a dark version of the icon color.

    Declaration
    [Tooltip("Color of the ''Image'' when the light is off. Black by default.")]
    public Color offColor
    Field Value
    Type Description
    Color

    onColor

    Image color when the light is active. Typically white or the characteristic color of the indicator (red, yellow, green, etc.).

    Declaration
    [Tooltip("Color of the ''Image'' when the light is on. White by default.")]
    public Color onColor
    Field Value
    Type Description
    Color

    Properties

    Active

    Gets or sets the active state of the dashboard light. When set to true, immediately turns the light on. When set to false, begins the hold and fade-out sequence.

    Declaration
    public bool Active { get; set; }
    Property Value
    Type Description
    bool
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics