I'm learning how Blueprints communicate with Unreal engine (5.3) but having troubles getting my blueprints to communicate with a Interface, I think i have set this up wrong? perhaps its something i missed. I simply cannot call the data from the Component.

I'm trying to get the Location data from the Projectile Blueprint to a Actor Component. This is for a grappling hook.

I have a 3rd person character in that a Input that spawns and fires the projectile, in the projectile actor i have it set up so when it hits or collides with anything it fires off an event, getting hit and makes transform and setting it a variable.

I have a interface called Game data, and function called Grapplehook Info with a input for GH_Hitlocation, I have added the interface through the class settings to both the Projectile and the Actor component

it seems it wont call the function in the Actor Component? Image of a the 3 BP's attached

Image of the 3 Blueprints

I expected that once i called in the Interface BP i could just pass the info through the call event in the other Blueprint and it was all fine, but it seems when the data tries to pass i just simply doesnt.

I had issues where the Actor componet was telling me that i could not use the event as it was a duplicate name event. but when i dragged the pin from the interface it was just a set node for input not output which i needed, I checked the advance boxes playing with Const, Exc, and ect what worked so far in getting rid of the dup name was call in editor check.

1

There are 1 best solutions below

1
Samaursa On

It seems you have some fundamental misunderstanding of what Interfaces are (especially in Unreal) and how to pass data from one Object (your Projectile Blueprint) to an Actor Component (GrapplingComponent) where the Actor Component is attached to an Actor (which you have made no mention of).

The only way for your Grapple Info interface function to be called on GrapplinComponent is by invoking the Grapply Info interface function on the component. And you can only do that if you have a reference to the component itself (either directly, or through the ActorComponent base class). There are not some sort of a global event that is caught by every object that implements said interface.

In the screenshot, I have pointed out the pin that you are missing. This pin, for interface functions, is DefaultToSelf in Unreal but that's not always what you want. This pin must instead be conneted to the Actor Component.

enter image description here

In fact, you can even see on your interface function call, it says Target is Grappling Hook Projectile BP.

enter image description here

Moreover, interface functions should generally be called through their Message variant. For example, the following screenshot shows the interface call My Function as a message (envelope icon)

enter image description here

To sum up:

  • you need the reference to the ActorComponent (GrapplingComponent) through the Actor on which it has been added
  • the reference must be either stored on Projectile_BP or Projectile_BP needs to be able to get the reference somehow
  • invoke the interface function on the ActorComponent through the Projectile_BP by connecting the above mentioned pin to the component reference