Hi. I have a question about how to resume animation montage after pause. For example:
/** Pauses the animation montage. If reference is NULL, it will stop ALL active montages. */
UFUNCTION(BlueprintCallable, Category = "Animation")
void Montage_Pause(UAnimMontage * Montage = NULL);
How to correctly resume to play state? I am tying to use Montage_Play and have unexpected results.
Next I am waiting for Memory->Interval. After it was expired I am freezing the pose of the character:
auto MeshComponent = GetMesh();
MeshComponent->GlobalAnimRateScale = 0.f;
GetAnimInstance()->Montage_Pause();
Then my character has begun to recovery.
// Unfreeze
auto MeshComponent = GetMesh();
MeshComponent->GlobalAnimRateScale = 1.f;
if (AnimInstance->Montage_IsPlaying(Montage))
AnimInstance->Montage_JumpToSection(Montage->GetSectionName(SectionID), Montage);
else
Character->PlayAnimMontage(Montage, 1.f, Montage->GetSectionName(SectionID));
Memory->RecoveryInterval = Montage->GetSectionLength(SectionID);
I am waiting for recovery. And character was killed during recovery. And we are following to paragraph 1. At this point I am waiting for section playing. But at the end of playing montage was interrupted (blendout = 0). All sections was looped and I can not understand the reason for an interrupt.
Sorry, but I don’t see a way around that problem. There’s code in the animation system that automatically kills the animation if it’s paused (i.e. the weight is zero). It would be a rats nest to try to fix that.
My only other suggestion is to slow it down a lot, then restore it. Pause by calling SetPlayRate(0.001f), then restore by calling SetPlayRate(1.0f).