BP Communication from Animation to Character?

I am trying to use animation notifies to trigger an event in my character class (“MyCharacter”).

This is a spawned actor, so there are no references in the level to use.

It seems like Animation Notifies are only sent (and are only available) in the Animation Blueprint. This makes sense, however, I’m not seeing any way of communicating out of the Animation Blueprint back to the Character Blueprint that is using it.

What I’m looking for is something like “Get a reference to the character that is using you” from the Animation Blueprint, but I’m not finding anything. It looks like animation notifies also don’t pass an object reference for the object that sent the notify (if it did, I think that would solve it).

Using “GetPlayerCharacter” (and several of the other “Casting” options) just fails.

Anyone have any ideas how this could be done?

Hey there, try using “TryGetPawnOwner” node instead of “GetPlayerCharacter”.
Also the Animation Blueprint only has 2 default events, you could try using “BlueprintInitializeAnimation” to cast to MyCharacter and save the reference to a variable ( object type of MyCharacter BP), so you then have access to the MyCharacterBlueprint content.

Here is example of the way they did it in the “Platformer” example, this way MyCharacterBlueprint is casted each update of animation, pretty much like each tick, so it would seem a better way to avoid casting so many times but looks like this works just fine anyway.

That worked. I stored a reference on Initialization as well so it doesn’t have to do the cast every tick, and that worked fine. Thanks!!!

Doesn’t this create a circular reference between the Character that has a ref to the animbp and the animbp that has a reference to the character?

1 Like