Hello, I’m having an issue utilizing a variable in a skeletal mesh component BP that originates from the Animation BP. SlashingAni is a bool created within the Animation Blueprint and is set to public. I get the “Accessed None trying to read property FPAnim” error. Any suggestions? There is no cast to or anything within the Animation BP, is it needed?
Top left part of the photo shows how I have the Cast To set up in the Skeletal Mesh Component, bottom left shows how I have it triggering. Top right shows the bool within the animBP as well as how it is used.
Looks like your cast seem to be failing.
My suggestion is to change your approach, and let the AnimBP retrieve and read the state it needs to know about. In other words, you need a way to access the bool from within the AnimBP.
-
AnimBP has an event called Blueprint Initialize Animation, from there do a GetOwningComponent and cast to your BP_Sword_Component, save this reference to a variable.
-
AnimBP also has an event called Blueprint Update Animation, from there you get the new reference of BP_Sword_Component that you created, and retrieve the bool you want. Save a copy of that bool to a new variable in the AnimBP. This will update the bool every animation update (not super efficient, but will work for your needs).
-
Then in the transition rule you can use the new bool variable you created.
I have this set up for all of my other animations. They are all triggered within the animBP. But this component is a weapon system similar to how they have it in the FirstPerson template, where the item bp floats in the level and you walk over it and it attaches the weapon component to the hand socket. I am trying to have separate animations for each weapon type. So I would still like to relay some type of information to the AnimBP. Maybe I could route it all through the Character BP by adding some if statements and a couple extra bools? That sounds simpler. Thank you. I will try that and see how it goes.
How I have it set up now:
- Skeletal Mesh Component(weapon) BP sets a bool on the Character BP,
- Character blueprint has the “attack” event that once triggered, checks to see which weapon is attached through a series of if statements utilizing the bool from step 1,
- The same attack event sets a bool in the animation BP to activate the animation for the attack,
- The animationBP checks the bool from the previous step and executes animation
I have put Display Text actions throughout the blueprints to tell me at what state all the bools are in while they’re being called from the different blueprints and from what I can tell, they all set correctly and the animation plays. I do not know if this fixed any problems because I did not do a stringent Display Text analysis before I made changes. However, my OP issue seems resolved. The variables do transfer between everything appropriately now and the animation plays.