How to use Spine. Animation.Duration modify the length of the animation using the state machine(SkeletonMecanim). I want to move the frame back to make the animation longer. Although I can modify the value of the frame and make it work, I can't modify the length of the entire animation
Here are more details of the code
public SkeletonMecanim skeletonMecanim;
public Animator animator;
protected Skeleton skeleton;
protected SkeletonData skeletonData;
protected Spine.Animation moveAnimation;
void Start()
{
skeletonMecanim = GetComponent<SkeletonMecanim>();
animator = GetComponent<Animator>();
skeleton = skeletonMecanim.skeleton;
skeletonData = skeleton.Data;
//get animation , because there are only 1 animation and only 1 timeline so i write like this
foreach (Spine.Animation animation in skeletonData.Animations)
{
moveAnimation = animation;
}
//look at this!
//This does not take effect. The length is still the original length
moveAnimation.Duration = 10;
//get TranslateTimeline
TranslateTimeline translateTimeline = null;
foreach (Timeline timeline in moveAnimation.Timelines)
{
translateTimeline = timeline as TranslateTimeline;
}
//The moving value of this frame has been successfully changed,
//but the animation length still remains unchanged
//why and how to deal with this orzzzzzzzz
translateTimeline.SetFrame(1, 10, 50, 60);
}
So what's the problem )))