Search Unity

Customize the title of timeline clips

Discussion in 'Timeline' started by adamgryu, Aug 14, 2017.

  1. adamgryu

    adamgryu

    Joined:
    Mar 1, 2014
    Posts:
    186
    Is there a way to customize the title of timeline clips so they are more descriptive? If not, this could be a cool feature to add.

    In my screenshot below, it would be nice to replace the text "PaperActorPlayableClip" with something more descriptive like "Set Emotion: Happy" Capture.PNG
     
  2. WikkidEdd1

    WikkidEdd1

    Joined:
    Nov 17, 2015
    Posts:
    10
    If you select the clip in the timeline you can set the name in the top of the inspector
    upload_2017-8-16_11-20-17.png
     
  3. adamgryu

    adamgryu

    Joined:
    Mar 1, 2014
    Posts:
    186
    Oops, I missed that somehow. Thanks!
     
  4. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    This can be accomplished in code as well (automagically). After creating the set of scripts in the Playable Wizard, in the 'drawer' script's OnGUI() method, access the DisplayName. For example, in a custom track for something using AudioClip's (exposed as exposedAudioClipField in the Behavior), set the clip DisplayName to the name of the AudioClip like so:

    Code (CSharp):
    1. // Grab the track clip and the AudioClip from the custom 'clip' script
    2. var clip = property.serializedObject.targetObject as CustomAudioClip;
    3. AudioClip audioClip = clip.template.exposedAudioClipField;
    4.  
    5. // Assume that the currently selected object is the internal class UnityEditor.Timeline.EditorClip
    6. // this gives you access to the clip start, duration etc.
    7. SerializedObject editorGUI = new SerializedObject(Selection.activeObject);
    8.  
    9. // Grab the clip title, set new title
    10. SerializedProperty title = editorGUI.FindProperty("m_Clip.m_DisplayName");
    11. title.stringValue = audioClip.name;
    12.                
    13. editorGUI.ApplyModifiedProperties();
    14.  
    This was tested in Unity version 2017.1.
     
    WikkidEdd1 likes this.
  5. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    Note for Unity 2017.2+, the property root is "m_Item" vice "m_Clip".