Jump to content

Vincent Laugier

Members
  • Content Count

    2
  • Joined

  • Last visited

About Vincent Laugier

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I'm trying to do the following (in Unity): pause a running animation resume a paused animation jump to a given key of an animation hook to the end of an animation (in order to notify that the animation has stopped playing) EDIT (some solutions): To hook to the end of an animation, see 'AnimationFinished' in Animator.cs For jumping to the given key of an animation, here is a solution that works for my use case, I added the following function in Animator.cs (it's an adaptation of the 'Play' function) /// <summary> /// Go to key and stop /// </summary> public virtual void GoToKeyAndStop(SpriterAnimation animation, int keyRankFrom0) { // Use the first timeline to get the keys SpriterTimeline spriterTimeLine = animation.Timelines[0]; Time = spriterTimeLine.Keys[keyRankFrom0].Time; Speed = 0f; // will make the animation stop (=> you need to set 'Speed = 1f' in the 'Play' function) CurrentAnimation = animation; Name = animation.Name; NextAnimation = null; Length = CurrentAnimation.Length; }
×
×
  • Create New...