HELP: Can't link (AnimBP) As my character -> variable (MyCharacter)

The variable is from MyCharacter which I’m trying to set on CharacterAnimBP.

Hello,
From your “cast to” drag the variable you want to use and then “set” your variable with it. If you want to set a variable in animBp from a variable in character Bp. Invert get and set to do the opposite.

Hello Fen, how can I invert the set to get? Because I’m trying to get the variable from MyCharacter BP to AnimBP for “As My Character”.


Is this what you meant?

Would it be the same as what the video showed at 5:14?

Yes about the video : In the video you see both “get” and “set” variable, depending if you want to have the current value of the variable or change it. Drag the one you need and use it in the blueprint.

So this will get me the current value of the variable which is the input from MyCharacter? What if I have more action events, do I put them to “cast to My Character” as well?

I’ve just tried to play it, but my character can’t punch when I click left mouse button.

“Cast to” is the main way to instantly retrieve variables / custom event / function from another blueprint. There are other communication systems too (interfaces / event dispatchers : https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintCommsUsage/BPComHowTo/index.html and check the content example project : blueprint communication map to discover them)

You don’t have to “cast to” for every variable you need to retrieve, but you will have to do one for each event or situation like branch. (there are some cases where using one in an event is good for another event but i prefer always using a dedicated “cast to” to avoid any possible trouble.) If you are not sure, add one “cast to” when you need and ask here for some help.

Having a variable doesn’t mean this is the only thing needed to have things working sadly (it would be really cool but we have some work to do to ^^). Verify that you have all your nodes set like in the video. If all is exactly the same, then you have to check if other parts of tutorial are different.

I’ve double checked that everything was exactly like in the video, but for me it’s showing “As My Character” instead of “As My Character C” in the video and Try get pawn has “target(self)”.

Ok :frowning: Is your trouble that you don’t find “ispunching?” in the action list dragged from the “cast to” output ? If yes, since 4.6 you need to make your variable editable (in your character blueprint, click on the eye near the variable name on the left (my blueprint), when it is opened. compile, save, come back to anim bp, compile, save too if needed to be sure and then try to find it then continue the tutorial to have your anim.

It works, haha I totally missed that out. Thanks a lot Fen for taking your time to answer my question!! :smiley:

Happy that helped you. And : Cheers ! It works !