Object A has a PlayableDirector
.
Object B has both a PlayableDirector
and an Animator
.
In A’s TimelineAsset, there is a track with three clips (playableAssets)
- In the first clip, I want B to play
TimelineAssetB_1
. - In the second clip, I want B to play
TimelineAssetB_2
. - In the third clip, I want B to play
TimelineAssetB_3
.
My approach is to create the Playable
for TimelineAssetB_*
within the clip (i.e., the playableAsset) using CreatePlayable
, and then pass that playable to A’s PlayableGraph to manage and control its playback.
Here is my code for the custom PlayableAsset
implementation:
public class ControlPlayableAssetEx : PlayableAsset
{
public TimelineAsset sourceObjectTimelineAsset;
[SerializeField] public ExposedReference<GameObject> sourceGameObject;
public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
{
GameObject sourceObj = sourceGameObject.Resolve(graph.GetResolver());
if (sourceObjectTimelineAsset != null && sourceObj != null)
{
var playable = sourceObjectTimelineAsset.CreatePlayable(graph, sourceGameObject);
playable.SetDuration(duration);
playable.SetPropagateSetTime(true);
return playable;
}
return Playable.Null;
}
}
but it doesn’t work. B do nothing when A play the director.
anybody can teach me how to do
TimelineAsset B
TimelineAsset A
PlayableGraph Visualizer
Visualizer: Animation Layer mixer input weight is 0 in Animation track