Get number of sections in a montage?

In short i want some sort of variable from montages that describe either the names of the sections or just a number telling me how many sections is in a montage.

My purpose for doing this is quite simple i want to randomize which animation play, say i got 6 sections and i want to randomize 3 of them to be random.

If anyone has a better idea for this please share, i am all ears.

Hey, thanks for the solution. However, there is an easier way:

int32 GetNumMontageSections(const UAnimMontage* montage)
{
	if (montage == nullptr)
		return 0;
	return montage->CompositeSections.Num();
}
4 Likes