GetBehaviour() from a new default TimelineClip

Hi!

I managed to create X number of timeline default clips through an Editor Button by using TrackAsset.CreateDefaultClip() and when I click on them through the inspector, I see that they have the good TrackClipTypeAttribute (it’s a dialogue box track that creates dialogue box clips that have a field supposed to contain text).

However, by creating default clips, I’m stuck with X number of TimelineClips and I can’t seem to be able to reach their custom properties (the text field) through code.

What I’m saying here is that I can’t reach the fields of my custom clips through code. My script only sees them as TimelineClips but the inspector knows that they have a text field.

Am I missing a cast or something?

Thank you!!

The field you are looking for is TimelineClip.asset. It points to an instance of the class you specified in the TrackClipTypeAttribute.

var myAsset = clip.asset as MyCustomClipType;
myAsset.myText = "blah";

I feel bad… The answer was right in my face. Thank you so so so much!