Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Timeline Clip Tint Color

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

  1. heisarzola

    heisarzola

    Joined:
    Oct 6, 2014
    Posts:
    10
    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:
    1,516
    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:
    960
    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:
    1,516
    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. }
     
  6. Cor1979

    Cor1979

    Joined:
    Oct 4, 2009
    Posts:
    65
    Were these changes implemented? I'm on 2019.4
     
  7. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Yes. The code posted works in 2019.4.
     
  8. Veuch

    Veuch

    Joined:
    Feb 4, 2020
    Posts:
    5
    Is there any way to do this without scripting now ? It has been a few years.