- Home /
Question by
eaglemaster7 · May 29, 2019 at 05:25 AM ·
animationtimeline
attach Animation PlayableAsset to TimelineClip
I'm trying to make Editor script that create Timeline and it's clip from _selected_gameObjects
so I wrote something like this:
GameObject TimelineMaster = new GameObject("TimelineMaster");
PlayableDirector director = TimelineMaster.AddComponent<PlayableDirector>();
TimelineAsset timeline = ScriptableObject.CreateInstance<TimelineAsset>();
foreach( GameObject i in _selected_gameObjects)
{
AnimationTrack newTrack = timeline.CreateTrack<AnimationTrack>(null, "");
TimelineClip current_clip = newTrack.CreateDefaultClip();
//
// NOW I AM CONFUSED TO CONNECT current_clip AND animationClip
// MISSING LINES SHOULD BE HERE
}
it wont attach animation clip automatically to the playableAsset, [image below] and as far as I tried I don't see reference to access that, what do I miss, or am I doing it wrong ?
Any help would be appreciated , thanks
a.png
(38.2 kB)
Comment
Best Answer
Answer by seant_unity · May 29, 2019 at 11:23 AM
var animAsset = (AnimationPlayableAsset) current_Clip.asset;
animAsset.clip = animClipToAssign;