Class TrafficSignalMixer
Track-level mixer that resolves the dominant TrafficSignalBehavior each frame and pushes the resulting signal and flashing state to the bound TrafficSignalController.
public class TrafficSignalMixer : PlayableBehaviour
Inheritance
Remarks
Unlike numeric or transform tracks, traffic signals are discrete states that cannot be meaningfully interpolated. The mixer therefore uses a winner-takes-all strategy: it picks the clip with the highest blend weight and applies only that clip's settings, preventing invalid half-red/half-green states during Timeline cross-fades or overlapping clips.
The optional NumericValueDisplay countdown is driven from the same dominant clip, so the in-world timer always matches the active phase — important for research protocols where participants need to see how long until the signal changes.
Methods
OnBehaviourPlay(Playable, FrameData)
This function is called when the Playable play state is changed to Playables.PlayState.Playing.
Retrieves the TrafficSignalController and NumericValueDisplay from the track binding.
public override void OnBehaviourPlay(Playable playable, FrameData info)
Parameters
| Name | Type | Description |
|---|---|---|
playable | Playable | The Playable that owns the current PlayableBehaviour. |
info | FrameData | A FrameData structure that contains information about the current frame context. |
ProcessFrame(Playable, FrameData, object)
This function is called during the ProcessFrame phase of the PlayableGraph.
Evaluates the most significant input clip and applies its signal, flashing state, and time display logic each frame.
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
Parameters
| Name | Type | Description |
|---|---|---|
playable | Playable | The Playable that owns the current PlayableBehaviour. |
info | FrameData | A FrameData structure that contains information about the current frame context. |
playerData | object | The user data of the ScriptPlayableOutput that initiated the process pass. |