A lot of stuff to Commit because I forgot to Commit in between (Don't do stuff like this, kids)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user