Hi everybody.
I’m writing my own Playable type for unity timeline, but I am stuck in the middle of way.
I’m trying to access to offsets of a specific clip in unity’s default Animation Track, for example the first clip.
I can reach to the Animation Track and even it’s Position (offset),and even it’s clips but I can’t get to the Animation Playable Asset Properties like clip offset. Please help me.
this is what I have tried:
using System.Linq;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
// this is an simple version of what I'm looking for, I only write this in a simple script to show my Problem
public class MagnetiveClip_Main : MonoBehaviour
{
public PlayableDirector timeline;
void Start()
{
PlayableAsset playableAsset= timeline.playableAsset;
var outputs=playableAsset.outputs.ToArray();
// Although I know that it is always not going to be the first track but here for simplicity we use the first track
AnimationTrack animationTrack=outputs[0].sourceObject as AnimationTrack;
Vector3 iDontWantTheTrackOffset=animationTrack.position;
var clips=animationTrack.GetClips().ToArray();
//clips[0].positon - this doesn't exist
//even i cant cast
//AnimationClip animationClip=clips[0] as AnimationClip; - this doesn't work
//AnimationPlayableAsset animationPlayableAsset=clips[0] as AnimationPlayableAsset; - this doesn't work
}
}
Thanks in advance.