How do you reference variables in your animation blue print in a class, or how do you reference variables in a class from your animation blue print?
#Set Custom Anim BP Vars in Code
I wrote a wiki tutorial on this here!
PS: has pictures!!!
This appears to be through code. Is there no way to do this in blue print itself?
To reference your AnimBP from another Blueprint, you’ll need to call the Mesh being used on the Character or Pawn in question, then get that Mesh’s Anim Instance, and Cast it back to the AnimBP you are using. That will let you get/set variables in that instance of your AnimBP. Here are some examples of what that node setup would look like:
Edit: This example is based on the Third Person (Blueprint) Template
From a Character Blueprint:
From a Level Blueprint:
If you have any questions about this setup, please let us know!
Does this only work for “character” or “pawn” classes? What about an actor class? For instance. I have an actor class that has a cylinder rigged. My class gets a variable updated every frame. Now I need that variable inside the cylinders anim BP. So Cylinder class → cylinder’s AnimBP.
Yes, it should work for any Actor blueprint. If you have an actor blueprint with a Skeletal Mesh Component you need to reference, you’d just call the Skeletal Mesh Component in your blueprint and use the same node setup. Didn’t mean to sound like this was exclusive to Character/Pawn, those were just the first to come to mind for examples.
If you have a specific setup you’re having trouble with, post a screenshot of your Eventgraph and we’ll be glad to help guide you in the right direction.
I should have tried before asking anyhow, My bad, I’ve been puzzled by this for a week now so I was just assuming I needed more info. I just set it up using skeletal mesh and it worked. Huge thanks! I appreciate it a great deal.
An answer to this is to use the skeletal variable in the class BP, from the skeletal object you can cast to the Anim BP that you want, then you can set variables in it from directly in your class.
I know this is old, but I have a question if it’s still a possiblity, it refers to the images just above…
In the first image you have Set Speed but with a target node. How did you get that target node, it doesn’t appear on mine.
drag off of the Cast to node from the blue output pin that says "As ", then type in the variable you want to set.
I know this is kinda of ancient now but could you help me in my thread? If so, please follow the link : thread
Thanks for asking this question. I was having a similar issue.
This helps me !Thx dude
hi. Steve Allison & Thumper.
I want to make that snowman is growing ,when i press G key in other Actor Blueprint. only works in actor BP,no character or no pawn.
Thus i made that cast to animation blueprint’s bool value from Actor BP. but it doesn’t works
How can i manage bool value in animation Blueprint? i have nothing to do with from Actor BP to Anim BP / from Anim BP to Actor BP.
thx for read my thread and if you have solution of this,I really wish and appriciate to attach with blueprint pictures. thx!
Hello, this doesn’t work. Has anything changed in the last 6 years to make this not work?
This works fine still, what are you struggling with?