GetMesh() is undefined?

Hi,

You really should have to. Here the code I use:



if (UseAnim)
{
      MyPawn->PlayAnimMontage(UseAnim);
}


MyPawn is an


ACharacter*

UseAnim is an


UAnimMontage

This is the implementation for PlayAnimMontage (its a function I made)



float AMyCharacter::PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate, FName StartSectionName)
{
    USkeletalMeshComponent* UseMesh = GetPawnMesh();
    if (AnimMontage && UseMesh && UseMesh->AnimScriptInstance)
    {
        float time = 0.0f;
        return UseMesh->AnimScriptInstance->Montage_Play(AnimMontage, InPlayRate);
    }
    return 0.0f;
}