How to get Player Character from animation blueprint

Hey,

I have a variable in my character blueprint that I want to access from my animation blueprint. I’ve tried ‘get character’ and cast it to my character class, but it fails.

Any ideas?

First, you need to make your variable editable in your character blueprint by clicking the eye icon on the right side of the variable.

34008-1.png

Second, get or set the variable by casting your character blueprint inside your animation blueprint just like the second image.

I hope that helps.

Hi thanks for the info. Unfortunately, it’s not working. I’ve set it up like you did, but when I try to cast to my characterclass, it fails.

edit: Ok if I try to print the display name of the pawn owner, it just gives an empty string. This means there is no pawn owner?

Managed to solve this. Instead of getting my character class in the animation blueprint, I got the animation instance in my character blueprint and set my variable that way.

34358-solved.jpg

1 Like

Try putting an “Is Valid” execution node between your event and cast nodes and use your get pawn owner as input to it.

Then the event will only fire if the pawn owner is a valid pawn object.

It may be your event is firing when there is not yet a fully constructed pawn object to work with

like if there was only one character type in a game