Trying to get a track to pass a class reference to a playable behavior

Hello, I’m a beginner to the playables and timeline API.
My goal is to make a playable behavior that has a reference to a class on a game object in the scene.
But the class inherits an interface, I can’t pass in an interface
So I have the track binding as game object and I could use get component and get the reference of the subtype.
My idea was to use OnCreateClip to pass in the reference to the playable

Problem is I don’t know how to access the object that the track asset is holding

process frame has a parameter to the player data which is a reference to the track binding, but using getcomponent here would be expensive.

Is there any other way to get access to the track asset’s binding object?

I'm guessing I shouldn't use interfaces?

8272872--1083948--upload_2022-7-12_21-58-6.png
where is group transition stored?
is it an exposed reference?

https://docs.unity3d.com/ScriptReference/Playables.PlayableDirector.GetGenericBinding.html
Is this what im looking for?
Is the track asset what im supposed to pass in?
Can anyone confirm?

Let's say we have the following components:

public class BaseComponent : MonoBehaviour { }
public class DerivedComponent : BaseComponent { }

I can define a new track like this:

[TrackBindingType(typeof(BaseComponent))]
public class TrackBindingExample : TrackAsset { }

The Timeline window will only allow gameobjects with a component that is a BaseComponent (or a derived type) as a binding for your track.

8292728--1087094--demo_30.gif

In ProcessFrame, the playerData object will be the component assigned to the track:

public class ClipExample : PlayableAsset
{
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        return ScriptPlayable<PlayableExample>.Create(graph);
    }
}

class PlayableExample : PlayableBehaviour
{
    public override void ProcessFrame(Playable playable, FrameData info, object playerData)
    {
        Type dataType = playerData.GetType();
        Debug.Log($"PlayerData type: {dataType}");
    }
}

After adding the clip to the timeline, the console will print: PlayerData type: DerivedComponent

If you have a base interface instead of a class, Timeline won't automatically assign the binding; you'll have to add additional code to select the correct component. The TrackEditor class has methods to control which object can be bound to a track: IsBindingAssignableFrom and GetBindingFrom.