I realized looking at this: https://forums.unrealengine.com/t/how-can-i-get-skeletal-mesh-animinstance-and-then-cast-it-using-code/283271
that I have to change some code. I did that and it looks better, AnimInstance does not show a NULL anymore:
But still when I test play the game, the montage “AM_Sword” is not played when I attack. Do I need to anything in the animation blueprint? I only created the montage “AM_Sword”.