• Unity
  • PlayableDirector not satrting after it was paused.

I checked the documentation of Spine 4 release and it says that such a thing should be working but maybe I am not doing something correctly. Here is my issue:

  1. I start the PlayableDirector, it has a single SpineTrack just for test, when i pause and resume the track the animation doesn't continue as it should and when I check the "SkeletonAnimation" component the field "Animation Name" is <empty>

  2. Also I am not sure how to do the following: How can I put a default animation that runs every time SpineTrack ends? Currently when the track ends it just stops, can I make it so that if there is not SpineTrack running or after the SpineTrack ends every time to be an "idle" animation or whatever animation i choose as default instead of being empty?

Related Discussions
...
vladislavrr wrote
  1. I start the PlayableDirector, it has a single SpineTrack just for test, when i pause and resume the track the animation doesn't continue as it should and when I check the "SkeletonAnimation" component the field "Animation Name" is <empty>

Could you please describe in more detail how you paused and resumed the track? Does it also not pause and do you have Don't Pause with Director active? This would then continue playing the animation (e.g. an idle or talking animation) while the timeline is paused, but if it is not set to Loop it will end after a single iteration.

vladislavrr wrote
  1. Also I am not sure how to do the following: How can I put a default animation that runs every time SpineTrack ends? Currently when the track ends it just stops, can I make it so that if there is not SpineTrack running or after the SpineTrack ends every time to be an "idle" animation or whatever animation i choose as default instead of being empty?

I'm not sure if this is what you need: you could add a clip with the idle animation to the track after your last animation, enable Loop and Don't End with Clip. Don't End with Clip ensures that the animation is not stopped when the clip ends with whitespace and continues normally.

It seems that when I was pausing with playableDirector.Stop(); and resuming with playableDirector.Start() the animation was not starting as it should. But i changed it to playableDirector.playableGraph.GetRootPlayable(0),SetSpeed(0) and now it seems to be working as expected.

About the other solution with "Don't end with clip" i don't think it will do the job.

For example let's check this timeline. Spine is on Track 1 and Track 3, these are 2 different characters. I would like to be able to start the timeline at different spots, not every time at 0. So currently when i go to the position where the pointer is on the image for example there is no clip for the second player because it comes later, so I would like there to be an Idle animation for example. That's what I am trying to achieve, i guess an option is to fill all the empty spaces with Idle clips and when the character dies with death clips but not sure if that is the best solution. Also i should mention that I am creating the whole timeline trough code.

vladislavrr wrote

It seems that when I was pausing with playableDirector.Stop(); and resuming with playableDirector.Start() the animation was not starting as it should.

You are saying playableDirector.Stop(); (which is stopping and rewinding to 0) and playableDirector.Start() (which does not exist), but I assume you meant playableDirector.Pause(); and playableDirector.Play(); instead, right?

I just tested behaviour with playableDirector.Pause(); and playableDirector.Play(); and could reproduce a problem there, thanks for reporting! (Even in case this was not what you intended to report.)

Oh yes.. Play and Pause 😃 .. Well like I wrote the above solution for me was to control with SetSpeed.

About the other problem I ended up like you suggested just to add states for all animations on the tracks. I wasn't sure if it will be what i want but it turned out pretty good.

After trying to distinguish Timeline Director Pause from Stop behaviour (the Stop logic is triggered while we would want to receive Pause behaviour), it turns out that Unity never seems to have fixed this Timeline behaviour bug:
https://forum.unity.com/threads/weird-cinemachine-camera-behavior-in-timeline.484804/#post-3251176

They suggest the following:

// pause
GetComponent<PlayableDirector>().playableGraph.GetRootPlayable(0).SetSpeed(0);
// play
GetComponent<PlayableDirector>().playableGraph.GetRootPlayable(0).SetSpeed(1);

While we would rather suggest the following in order to not mess with Speed:

// pause
var count = playableDirector.playableGraph.GetRootPlayableCount();
for (var i = 0; i < count; i++) {
   var playable = playableDirector.playableGraph.GetRootPlayable(i);
   playable.Pause();
}

// play
var count = playableDirector.playableGraph.GetRootPlayableCount();
for (var i = 0; i < count; i++) {
   var playable = playableDirector.playableGraph.GetRootPlayable(i);
   playable.Play();
}

It's a pity such workarounds are still necessary.. :rolleyes: