Global variable on the Anim Graph

Hi, I created a string variable on the Character BluePrint, that says what weapon is using the player. The problem is that this variable can’t be used on the Animation BluePrint to handle a specific animation when the player is using a certain weapon.
What I have to do to use this variable on a condition on the Anim Graph?

Is the problem getting the variable from the player to the anim graph?
If so, create a public variable on your anim, and then get the anim out of the character of the player, and cast to your anim class, and then Set the variable value into that variable.
You can do this within Event Tick, or each time the weapon is changed.

I want to set the state from Idle to Weapon_Idle, but I need to know what weapon is currently in the hand of the player.

http://puu.sh/9Uk2F/349a02f754.png

http://puu.sh/9Ukgh/dbfe5dd911.png

You can set variables on your animation blueprint from the pawn blueprint by getting the animation, and casting to your animation blueprint class, and then setting the variable.
Note that “cast as” works best when you have compiled all the blueprints after changes, and drag out from the “get the animation” part of the “get the skinnedmesh” part of the “get the pawn” part of the controlled pawn.

I did this, but it doesn’t work.

http://puu.sh/9V1uB/8522603d5b.jpg

First, what errors are you getting?
Second, if you put a breakpoint on the “is valid” node, does it actually execute?
Third, is the variable actually a “class” (in which case it won’t work) or is it an “instance”?

  1. Accessed None ‘SoldierCharacterClass’ from node Set localCurrentWeapon in blueprint Soldier_AnimBlueprint
  2. What’s a Break Point? Anyways it is not valid, so IsValid is not executed.
  3. It’s an object (the second blue option):

http://puu.sh/9WwTw/cd15b1394f.png

  1. So the problem is that you haven’t actually set up the proper object. You need to do that.
  2. Debugging blueprints: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Debugging/index.html#breakpoints