communication between level blueprint and anim blueprint

Hi, I am having trouble in communicating between level blueprint and anim blueprint. The details are-

  • I want to send value of variable “direction” from level blueprint to animblueprint
  • For this purpose I have made a variable “Direction Value” in anim blueprint
  • And I need to “set” that variable in level blueprint
  • To communicate with anim blueprint I have made another “object variable for referencing animblueprint” named “animblueprint” in level blueprint.

It should have worked, but its not working. I have checked through “print string”. The value itself in level blueprint is OK. The only problem it is not sent to the anim blueprint. Am I missing something in making the “object variable for referencing animblueprint”? Do I need to specify it somewhere else? I have past the screenshot. If anyone have any idea what’s missing, please suggest me.

You made made a variable that should point to your anim blueprint, but do you make it point to the right anim blueprint instance? For example if I make an Actor variable, but it doesn’t point to the right actor then I can’t do anything with it. You can grab a reference to a pawn’s anim blueprint by:

  • Getting a reference to the pawn
  • Then getting a reference to its mesh
  • Then getting a reference to the mesh’ AnimInstance and casting it to your anim blueprint type

But! Since your original goal is to get data into the animation blueprint, here is a different approach: let the anim blueprint itself retrieve the data from the actor. Anim blueprints have an animation graph and an event graph. They have access to the same variables, so typically an anim BP’s event graph retrieves data from the actor which the animation graph can then use. In the event graph, you can use a TryGetPawnOwner node returns the owning pawn (if the actor is a pawn). GetOwningComponent returns the owning component, most likely a skeletal mesh component.

So to get data to the animation graph, here is a way to do it:

  • Create a variable on the anim BP, for example Speed
  • In the anim BP’s event graph, get the owning pawn and store its speed in Speed
  • In the anim BP’s anim graph, use the Speed to control animation

Hi NisshokuZK,
Thanks for replying. Your first part is good enough for me and by getting mesh the problem solved. Really appreciate your help.

Thank You [USER=“23394”]Zhi Kang Shao[/USER] for this fix! As @razee01 suggested first part is enough to make it work.