[Retargeting] Could Timeline Track/PlayableDirector binding keys be visible in the project view ?

Hello,

In a current project I have a timeline that I want to play at different moments and different locations. That means that the context is different each time but the configuration is the same : there is always the main game character and an enemy and this is all the timeline need to work as expected.

On my side, as a developer, I need to re-bind the “enemy” track with the current enemy using the
SetGenericBinding method. What I find annoying is that the key is an object and that object we can’t select it directly in the project view. Could be useful to be able to selecte a timeline track which is a binding key and assign it inside a Object field within a script.

From a PlayableDirector using the debug view those objects are visible from the inspector but no way to really select them from the project view therefore no way to use them inside a custom script.

I can use track name to find the right PlayableBinding but it’s not really safe because the name could change and it’s not as really useful as be able to directly target the key object.

All that speech (I hope it does make sense) to ask if those object ( my understanding is that they represent timeline track) could be visible inside the project view as timelines are ?

Thanks

You can make them visible as subassets of the timeline asset with the following script.

    void ShowTimelineTracks (TimelineAsset asset)
    {
        if (asset)
        {
            foreach (var track in asset.GetOutputTracks())
            {
                track.hideFlags &= ~HideFlags.HideInHierarchy;
                UnityEditor.EditorUtility.SetDirty(track);
            }
            UnityEditor.AssetDatabase.SaveAssets();
        }
    }
1 Like

Hello,

First of all thank you.

How that script get executed ? Where should I put this script on ?

Where ever it makes sense for your workflow. You could put it on a Monobehaviour on the same object as the playable director and have it apply automatically, or make a simple window with a button that takes a timeline asset. Or just a menu item that applies it to all timeline assets in project.