I have this code to play an AnimMontage or a particular section of it:
float MyClass::PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate, FName StartSectionName)
{
	USkeletalMeshComponent* UseMesh = GetPawnMesh();
	if (AnimMontage && UseMesh && UseMesh->AnimScriptInstance)
	{
		float Duration = 0.f;
		// If the Montage is not playing it must be started
		if( !UseMesh->AnimScriptInstance->Montage_IsActive(AnimMontage) )
		{
			Duration = UseMesh->AnimScriptInstance->Montage_Play(AnimMontage, InPlayRate);
		}
		// After it has been started (if required) in case a Section has been explicited it is played
		if( StartSectionName != NAME_None )
		{
			// Jump to the specified section of the montage
			UseMesh->AnimScriptInstance->Montage_JumpToSection(StartSectionName);
		}
		return Duration;
	}
	return -1.f;
}
I’m not sure this is the correct use of sections but, if it is, I need to get the duration of a specific section. In the way above it always give me the Duration of the whole AnimMontage.
Is there a way or I am doing something that shouldn’t be done?
Another way to solve my problem is by using BranchPoints or AnimNotifies but at this point I don’t know how to catch a notify directly from code instead than from a blueprint how is shown in the AnimMontage online docs.

