Hi, I’m so glad that it could help you. I’m going to make some sample scenes for people to understand.
For your question, I hope you’re talking about the bindings of a track in a timeline.
In order to set, change bindings, you need to get access to the track first.
If your new timeline is an empty timeline, then what you need to do is adding a track and make the bindings to a specific gameobject. But to add a track, Unity only provide a function “CreateTrack” which cannot be directly used without track index. Here is something interesting, in the Unity Script API, there is only one function “T CreateTrack(Timeline.TrackAsset parent, string name)”. However, if you go to Visual Studio and in your library there are two functions called “CreateTrack” in the same class TimelineAsset. So, the method I’m using is C# reflection.
MethodInfo method = typeof(TimelineAsset).GetMethod("CreateTrack", new[] { typeof(TrackAsset), typeof(string) });
MethodInfo generic = method.MakeGenericMethod(trackType.GetType());
TrackAsset newName = null;
var track = generic.Invoke(timeline, new object[] { null, DEFAULT_ANIMATION_TRACK_NAME + bindings.name });
newName = track as TrackAsset;
director.SetGenericBinding(newName, bindings);
You can check also in the TSEiATimelineManager, function AddTrack(TrackAsset trackType, GameObject bindings).
The “director” is the PlayableDirector.
if your new timeline is not empty, for instance you’ve added some tracks manually, then what you need to do would be quite easy. Just do:
director.SetGenericBinding(tack, bindings);
To get the “track”, you need to use the index of that track.
Good Luck!