Playing amination montage

Hey everyone, I am trying using animation without using blueprints at all, I need to use blend space and montage animation. The blend space seems to work but the montage animation is not. I have read the topic: How can I play animations strictly from C++? - Character & Animation - Epic Developer Community Forums and tried the given answer but it did not work, when I tried to find out why I have figured that GetAnimInstance returns null, probably because I do not have animBP setted (again, I do not want to use any blueprints from any kind).

I have also tried to use the function PlayAnimMontage on BeginPlay:



void ALiving::BeginPlay()
 {
     ACharacter::BeginPlay();
     
     this->PlayAnimMontage(this->m_attackAM);
 }


And again it did not do anything.

How can I play montage?

I dont know if this will be any help but this is how i play my anim montages

include “Animation/AnimInstance.h”

if (GunReloadAnimation != NULL) {
UAnimInstance* GunAnimInstance = WeaponMesh->GetAnimInstance();
if (GunAnimInstance != NULL) {
GunAnimInstance->Montage_Play(GunReloadAnimation, 1.0f);
}
}

Thank you for the quick reply, but as I have said, I have tried to so but GetAnimInstance returns NULL: