- Home /
Change TimeLine clip display name based on parameters
Hi, I would like to know if there is a way to change the text being displayed inside the clip on the Timeline editor - primarily based on set parameters - so the we can get some detail of what the clip does at a glance. For example, it would allow the TextSwitcherClip from the PlayableSample to display what the new text that will be assigned will be.
Answer by sregnault · Jul 14, 2020 at 04:48 PM
You can use Clip Editor from Unity 2019.2 or higher
public class MecanimControlClippEditor : ClipEditor
{
public override void OnClipChanged(TimelineClip clip)
{
var shotClip = (MecanimControlClip)clip.asset;
if (shotClip == null)
return;
if (!string.IsNullOrEmpty(shotClip.Template?.stateName))
clip.displayName = shotClip.Template.stateName;
else
{
clip.displayName = "AnimEmpty";
}
}
}
Answer by seant_unity · Mar 09, 2018 at 12:17 PM
We will have a better solution out for this problem in a future release, but a workaround for doing this is overriding CreateTrackMixer() in your custom TrackAsset class. Cinemachine is doing something similar public override Playable CreateTrackMixer( PlayableGraph graph, GameObject go, int inputCount) { // Hack to set the display name of the clip to match the vcam foreach (var c in GetClips()) { CinemachineShot shot = (CinemachineShot)c.asset; CinemachineVirtualCameraBase vcam = shot.VirtualCamera.Resolve(graph.GetResolver()); if (vcam != null) c.displayName = vcam.Name; } var mixer = ScriptPlayable<CinemachineMixer>.Create(graph); mixer.SetInputCount(inputCount); return mixer; }
Your answer
Follow this Question
Related Questions
Force a timeline clip to a fixed duration 2 Answers
Customize Timeline Clip background 0 Answers
Positioning timeline clip by script 1 Answer