# Timelines - Event Track

**URL:** <https://qa.fmod.com/t/timelines-event-track/20046>\
**Category:** Unity\
**Created:** [March 31, 2023, 10:44am UTC](https://qa.fmod.com/t/timelines-event-track/20046 "2023-03-31T10:44:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko.ravnjak](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@marko.ravnjak](https://qa.fmod.com/u/marko.ravnjak)\
**Post date:** [March 31, 2023, 10:44am UTC](https://qa.fmod.com/t/timelines-event-track/20046/1 "2023-03-31T10:44:30Z")

</div>

Since timeline track coloring works per type, I’ve wanted to just extend the existing classes:

FMODEventTrack / FMODEventTrackEditor

and change the color via class attributes, but I’m getting an exception which originates from unity native code (unsupported type), I’m assuming it’s track binding related since type is now FMODEventTrack2.

Any idea if there is a workaround?

Our devs would just like a visual distinction between multiple event tracks…

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 3, 2023, 6:30am UTC](https://qa.fmod.com/t/timelines-event-track/20046/2 "2023-04-03T06:30:09Z")

</div>

Unfortunately, you cannot dynamically adjust timeline track color via class attributes. I believe this is a limitation with Unity - while you can change the color in the `FMODEventTrack` script by changing the appropriate class attribute (i.e. via assigning to `[TrackColor(0.066f, 0.134f, 0.244f)]`), you cannot set it dynamically.

That said, you can use [`UnityEditor.Timeline.TrackEditor`](https://docs.unity3d.com/Packages/com.unity.timeline@1.8/api/UnityEditor.Timeline.TrackEditor.html) to accomplish this instead, which `FMODEventTrackEditor` inherits from.

If you add the following line to the member declarations of `FMODEventMixerBehaviour` in `FMODEventTrack.cs`:

```auto
public Color color = new Color(0.066f, 0.134f, 0.244f);

```

and replace the code in `FMODEventTrackEditor.cs` with the following:

```auto
#if UNITY_TIMELINE_EXIST

using UnityEditor;
using UnityEditor.Timeline;
using UnityEngine;
using UnityEngine.Timeline;

namespace FMODUnity
{
    [CustomTimelineEditor(typeof(FMODEventTrack))]
    public class FMODEventTrackEditor : TrackEditor
    {
        private static readonly Texture2D icon = EditorUtils.LoadImage("StudioIcon.png");

        public override TrackDrawOptions GetTrackOptions(TrackAsset track, Object binding)
        {
            TrackDrawOptions options = base.GetTrackOptions(track, binding);
            options.icon = icon;
            options.trackColor = ((FMODEventTrack)track).template.color;

            return options;
        }
    }

    // This custom property drawer is here to draw the volume property at the
    // top level of the inspector, rather than in a Template foldout.
    [CustomPropertyDrawer(typeof(FMODEventMixerBehaviour))]
    public class FMODEventMixerVolumeInspector : PropertyDrawer
    {
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            SerializedProperty volumeProperty = property.FindPropertyRelative("volume");
            SerializedProperty colorProperty = property.FindPropertyRelative("color");
            EditorGUILayout.PropertyField(volumeProperty);
            EditorGUILayout.PropertyField(colorProperty);
        }
    }
}

#endif

```

Then you’ll be able to set custom colors for each FMOD Event Track in your timeline. This is a very basic implementation, so your event playables on the track won’t inherit the color, but I’ve added this to our internal feature/improvement tracker. If you run into any issues, feel free to let me know.

---

<div class="post-metadata">

**Author:** ![marko.ravnjak](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@marko.ravnjak](https://qa.fmod.com/u/marko.ravnjak)\
**Post date:** [April 3, 2023, 8:50am UTC](https://qa.fmod.com/t/timelines-event-track/20046/3 "2023-04-03T08:50:31Z")

</div>

tnx, will try it

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [April 11, 2023, 11:56pm UTC](https://qa.fmod.com/t/timelines-event-track/20046/4 "2023-04-11T23:56:37Z")

</div>

Hi, just following up on this - did the provided script work for you, and address your need for a visual distinction between timeline event tracks? If not, was there any specific things that needs to be addressed?

---

<div class="post-metadata">

**Author:** ![marko.ravnjak](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@marko.ravnjak](https://qa.fmod.com/u/marko.ravnjak)\
**Post date:** [April 12, 2023, 6:41am UTC](https://qa.fmod.com/t/timelines-event-track/20046/5 "2023-04-12T06:41:54Z")

</div>

Hei Leah,  
yep, we are all good.

Thanks again.
