How do I tell a montage to loop?

Dear Friends at Epic,

Yaaay Thank you for UE4!!!

I’m using the montage playing functions from shootergame example.

I understand that there are new montage functions already in the upcoming build

but how do I currently tell a montage to loop itself?

I see how to make an animsequence loop itself in the anim blueprint.

but I want to make a looping montage without having to call it repeatedly in the code

:slight_smile:

for your reference:

float AVictoryCharacterBase::PlayAnimMontage(class UAnimMontage* Anim, float PlayRate)
{
	float Duration = 0.0f;

	//modified from shootergameCharacter.cpp
	if (Anim && Mesh && Mesh->AnimScriptInstance)
	{
		Duration = Mesh->AnimScriptInstance->Montage_Play(Anim, PlayRate);
	}

	return Duration;
}

Rama

In the Montage itself, make sure you have a Section for the animation you want to loop.

In the Section area, click the track for that section, then click the button for that same Section. This will tell that Section that it is supposed to loop. You can do this with one or more animations.

So here we have a string of animations defining a swinging weapon. We want the Swing1 and Swing2 sections to loop until we let go of the mouse button. So in the Sections area, we choose the track for Swing1, then click the green Swing2 button. Then click the newly added Swing2 in that track, and click the green Swing1 button to add Swing1 again. Montage detects the repetition and turns that Section into a looping one. Now, whenever you call that section to play, it loops automatically, playing Swing1, then Swing2, then Swing1 again, and so on.

I hope this helps!

4 Likes

oooh wow thanks Zak!

I dont think I would have guessed all that in a very very long time :slight_smile:

I saved your description and the picture to my hard-drive, thanks for taking the time :slight_smile:

Will probably write up a tutorial on this once I get it all working :slight_smile:

Thanks again!

Rama

Thank you Rama we are still using your answer 5 years later

For more recent versions, here is the answer

1 Like