Class TrafficSignalBehavior
The runtime PlayableBehaviour counterpart to TrafficSignalClip. Carries clip-level configuration into the playback graph and computes remaining clip duration each frame so the mixer can drive a countdown display.
public class TrafficSignalBehavior : PlayableBehaviour
Inheritance
Remarks
Unity's Timeline pipeline separates the asset (authored in the Timeline window —
TrafficSignalClip) from the runtime behaviour (evaluated each frame —
this class). Storing the clipAsset reference here lets the
TrafficSignalMixer read clip settings (signal type, flashing, timer visibility)
via the behaviour without needing a direct reference to the asset at the mixer level.
Fields
RemainingTime
The remaining duration (in seconds) of the clip in the track, evaluated at runtime.
public float RemainingTime
Field Value
float
Remarks
Data flows one way: Object) writes this value each frame based on
playable.GetDuration() - playable.GetTime(), and TrafficSignalMixer
reads it to drive the countdown display. Keeping the computation here (in the behaviour)
rather than in the mixer ensures each clip owns its own remaining-time state, which is
important when multiple signal clips overlap on the same track.
clipAsset
The clip asset that created this behavior instance.
public TrafficSignalClip clipAsset
Field Value
Methods
ProcessFrame(Playable, FrameData, object)
This function is called during the ProcessFrame phase of the PlayableGraph.
Updates RemainingTime each frame so the mixer can drive the countdown display.
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
Parameters
| Name | Type | Description |
|---|---|---|
playable | Playable | |
info | FrameData | |
playerData | object |
Remarks
The clipAsset.IndicateTime guard avoids the subtraction and assignment on every
frame for clips that do not show a countdown timer. Without it, every traffic-signal
clip — including simple red or green holds with no UI timer — would perform the
calculation unnecessarily.