Skip to main content

Class TMPTextSwitcherMixerBehaviour

A Timeline mixer that blends multiple TMPTextSwitcherBehaviour configuration inputs and applies the result to a TextMeshProUGUI component during Timeline playback.

This mixer is responsible for computing the final color and font size by weighting all active inputs, and for choosing the most dominant clip to determine the displayed text.

public class TMPTextSwitcherMixerBehaviour : PlayableBehaviour

Inheritance​

Methods​

OnPlayableDestroy(Playable)​

Called by the Timeline system when the playable graph is destroyed (e.g. exiting play mode or scrubbing away).

This method resets the bound TextMeshProUGUI to its original/default values (color, font size, and text content) that were cached before Timeline playback began.

This ensures that Timeline modifications are non-destructive and do not persist after the track is no longer active.

public override void OnPlayableDestroy(Playable playable)

Parameters​

NameTypeDescription
playablePlayableThe Playable (timeline track) that owns the current mixer.

ProcessFrame(Playable, FrameData, object)​

Called by the Timeline system once per frame while the timeline is playing.

This method evaluates all input clips on this track, blending their properties based on weight. It computes a weighted blend of:

  • Color: blended smoothly across active clips.
  • Single font size: also blended proportionally.
  • String text content: taken from the clip with the greatest influence.

If the total clip weight is less than 1 (e.g. when blending out), the original/default text settings are faded back in. This ensures smooth transitions between Timeline and non-Timeline states.

The result is applied directly to the bound TextMeshProUGUI component.

public override void ProcessFrame(Playable playable, FrameData info, object playerData)

Parameters​

NameTypeDescription
playablePlayableThe Playable (timeline track) that owns the current mixer.
infoFrameDataA FrameData structure that contains information about the current frame context.
playerDataobjectThe object bound to this track, expected to be TextMeshProUGUI.
  • Methods
    • OnPlayableDestroy(Playable)
    • ProcessFrame(Playable, FrameData, object)