- Home /
Gizmos for Timeline Clips
Hello Everyone!
I would like to know, if there is any way, to have gizmos be drawn for a custom clip (Playable) when selected in the Timeline. I would really love, to control the parameters via handles or to have them visualized as gizmos at least.
Answer by Tehenauin · Jul 07, 2021 at 02:03 PM
Ok, I somehow found my own little workaround. The only downside is, that I have to add an extra behaviour to the hierarchy.
here is the code:
using UnityEngine;
using UnityEditor.Timeline;
public class TimelineGizmoDrawHelper : MonoBehaviour
{
private void OnDrawGizmos() {
foreach (var clip in TimelineEditor.selectedClips) {
var drawable = clip.asset as ITimelineGizmoDrawable;
if (drawable != null) drawable.OnDrawGizmoSelected();
}
}
}
public interface ITimelineGizmoDrawable{
public void OnDrawGizmoSelected();
}
Now the clip has to implement the Interface, so it can have its own OnDrawGizmoSelected() method.
But if someone has a better solution, please let me know!
Your answer
Follow this Question
Related Questions
Labeling objects in the scene editor view 2 Answers
Unity 4.6 viewport problems 0 Answers
Editor Windows : Help required 1 Answer
How would you make a ray collide with a Gizmos sphere (float) 1 Answer