I followed "91. Hitting the Character" multiple times and the hit react montage doesn't play. The output log shows "Pressed 1" but not "Pressed 2 or 3". It returns and doesn't process the code to play the montage.
I tried renaming the Combat variable and it still happens. It returns Combat->EquippedWeapon as null. But doesn't return null in the PlayFireMontage, only the HitReactMontage.
I tried commenting out the if check for the combat and it outputs "Pressed 2" but the hit react montage still doesn't play even though the code runs inside the "if (AnimInstance && HitReactMontage)".
void ABlasterCharacter::PlayHitReactMontage()
{
UE_LOG(LogTemp, Warning, TEXT("Pressed 1"));
if (Combat == nullptr || Combat->EquippedWeapon == nullptr) return; //Returns here
UE_LOG(LogTemp, Warning, TEXT("Pressed 2"));
UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();
if (AnimInstance && HitReactMontage)
{
UE_LOG(LogTemp, Warning, TEXT("Pressed 3"));
AnimInstance->Montage_Play(HitReactMontage);
FName SectionName("FromFront");
AnimInstance->Montage_JumpToSection(SectionName);
}
}