You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
833 B
32 lines
833 B
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
public class SubtitleTrackMixer : PlayableBehaviour
|
|
{
|
|
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
|
{
|
|
var text = playerData as TextMeshProUGUI;
|
|
|
|
var currentText = "";
|
|
|
|
if (!text) { return; }
|
|
|
|
for (var i = 0; i < playable.GetInputCount(); i++)
|
|
{
|
|
if (playable.GetInputWeight(i) <=0)
|
|
continue;
|
|
|
|
var inputPlayable = (ScriptPlayable<SubtitleTrackBehaviour>)playable.GetInput(i);
|
|
var input = inputPlayable.GetBehaviour();
|
|
|
|
if (input.subtitleText != "")
|
|
{
|
|
currentText = input.subtitleText;
|
|
}
|
|
}
|
|
|
|
text.text = currentText;
|
|
}
|
|
}
|