Play animation montage without Blueprints

I am trying to play animation montage without using any blueprints.
My character has 2 states - Idle/Walk/Run which is done by blend space 1D. and attack - which is done by animation montage. To start the blend space, in BeginPlay:

    this->GetMesh()->PlayAnimation(this->m_walkRunIdleBS, true);

This seems to work well, The problem is playing the montage. On attack I do this:

    UAnimInstance* animInstance = this->GetMesh()->GetAnimInstance();
    LOG_CHECK_RETURN(animInstance != NULL, , "animInstance is null");
    LOG_CHECK_RETURN(this->m_attackAM != NULL, , "m_attackAM is null");
    DBG_DEF_PRINT("%f", animInstance->Montage_Play(this->m_attackAM));

LOG_CHECK_RETURN - checks the condition, is false returns from the function.
DBG_DEF_PRINT - simple print

On attack I can see that 1.3333 is printed on the screen which means playing the montage succeed but instead of playing the montage, the character sort of “blink” between the animations for a few frames and returns to the blend animation.

I have read this: Play animation montage (C++) - UE4 AnswerHub
I have tried to add slot to the montage as said but it did not work. I am pretty sure that I did it wrong. Will this help? how do I play slot animation montage right?


Nobody has an answer? :frowning: