Is there a way to change the icon of a custom Timeline track?
It’s undocumented, and may change in the future, but you can put a .png where the filename has the same name as your track (e.g. MyCustomTrack.png) in Assets/Gizmos/.
This worked! Thanks.
I’m on 2018.1 and this doesn’t seem to work. Tracks appear to always use the icon of whatever their binding object type is - so if I have a track with a binding type of Animator, the track shows the Animator icon. Tracks that don’t have a binding type always use the “Scriptable Object” icon - this one:
My custom icon does get recognized by Unity, as it shows up when selecting the track asset type itself in the project view. It’s a type that’s defined in a DLL, and within a namespace, but putting the icon file into folders that match the namespace definition does get that showing when the type is shown in the inspector.
Is the procedure for this different now, or is there no longer a way to override the icon on the Timeline track?
(also when will we be able to customize how tracks/clips are drawn? That would be fantastic for things like tracks that use a curve along their duration)
![]()
Hi, I just tried this too, no luck. Is there a new that this is supported?
Cheers
This still works for me. But it must be in the Assets/Gizmos folder (not any other gizmos folder, just that one).
Working in 2019.3, but had to restart Unity to get it to show up.
You can now also use a TrackEditor to supply the icon (icon field inside TrackDrawOptions), which is more useful if you want to change the icon based on the state of the track.
[CustomTimelineEditor(typeof(ShotTrack))]
public class ShotTrackEditor : TrackEditor
{
public override TrackDrawOptions GetTrackOptions(TrackAsset track, Object binding)
{
var options = base.GetTrackOptions(track, binding);
if (track.hasClips)
options.minimumHeight = ((ShotTrack) track).previewSize;
return options;
}
}
Hello, I’ve been reading the docs and it isn’t clear how to get the state of the track from the TrackEditor. I’d like to copy the functionality of Animator Tracks where the icon changes when a clip is active or not.
Here’s how I was able to apply a built-in icon to my custom timeline track:
using UnityEditor;
using UnityEditor.Timeline;
using UnityEngine;
using UnityEngine.Timeline;
[CustomTimelineEditor(typeof(AnimatorTriggerTrack))]
public class AnimatorTriggerTrackEditor : TrackEditor
{
override public TrackDrawOptions GetTrackOptions(TrackAsset track, Object binding)
{
var options = base.GetTrackOptions(track, binding);
// See: https://github.com/halak/unity-editor-icons
options.icon = (Texture2D)EditorGUIUtility.IconContent("d_PlayButton").image;
return options;
}
}