Search Unity

Timeline Clip Tint Color

Discussion in 'Timeline' started by heisarzola, Mar 16, 2019.

  1. heisarzola

    heisarzola

    Joined:
    Oct 6, 2014
    Posts:
    6
    Via an attribute at the top of the class, it is currently possible to select a custom color for the bottom section of each clip shown like this:


    (Notice the red, white and cyan colors)​

    However my question instead is:

    Is there any (user side) way to tint the colors of the individual clips? ​

    I would like to (for example) highlight a specific clip with red, when there are invalid or empty fields on it, without the need of manually having to view each track on the inspector to "validate" it.

    I know that built-in way is available, given how if you try to move a clip outside of a valid track (same type) it will be tinted red:

    upload_2019-3-16_10-26-43.png

    But is there any way, via an editor script or an override, that allows you to do this at the "still, not-currently moving" clips on the timeline?
     
    Sluggy likes this.
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    883
    Not yet, but the ability to change the highlight color of the clip, add custom error messages or icons and draw to the clip background are changes that are/will be available in 2019.2.
     
    heisarzola and Sluggy like this.
  3. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    332
    Mmmm, I'm sad to see this won't be in Unity 2018. I'm not about to go through another engine upgrade. However, it is nice to know that it will be available in the future! It might seem small but this is a vital feature for quickly identifying different types of custom clips, especially in complicated Timelines.
     
  4. tafkadasom2k5

    tafkadasom2k5

    Joined:
    Apr 25, 2019
    Posts:
    1
    That sounds like exactly what I am looking for at the moment! Is there maybe documentation available for these features?
     
  5. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    883
    Right now, there is only script documentation available, but there is more in the works and should be more released soon.

    The editors are similar to custom inspectors, in that you define them for the type. The difference is there is only one instance of the class for all clips of the same type.

    Here's a quick example to change the clip color on a track:

    Code (CSharp):
    1. using UnityEngine.Timeline;
    2. using UnityEditor.Timeline;
    3.  
    4. [CustomTimelineEditor(typeof(TransformTweenClip))]
    5. public class TransformTweenClipEditor : ClipEditor
    6. {
    7.     public override ClipDrawOptions GetClipOptions(TimelineClip clip)
    8.     {
    9.         var clipOptions = base.GetClipOptions(clip);
    10.         clipOptions.highlightColor = Color.red;
    11.         return clipOptions;
    12.     }
    13. }