Accessing variable value of blueprint that has an interface

Hi there,

I have a BP that inherits an interface for interacting with objects.
I can already execute the function perfectly.
I want to have a piece of text on the screen saying for example: [E] Interact with cube
I already am able to edit the value of that text, that I don’t need help with.
The text I want on the screen would be stored inside the BP that inherits the interface so I can edit it for each item.
How would I go about accessing the variable without knowing which BP I’m accessing?
(Say I interact and it could be any item, so I need to access the right one, I only have the Actor Object Reference from a Line Trace).

Thanks in advance!

Follow the next steps:

  1. Add a function to your interface:

  1. Override the function in the desired blueprint:

  1. Get your variable:

I hope it’ll be helpful for you.

My Products

2 Likes

Thank you!

I also want to input the value of an Input Action to the function.
I want it to display for example, [E] to interact depending on what the user sets as their preferred key.
How would I do this?

image

Thanks!

Quick question. Where does the Action Name come from in the last image?
I’m quite confused by that and where the key comes from in the second.
How can I input the Input Action? or InputMappingContext, those are the only things that have the value. As they’re defined using the new system and not the project settings.

Just ignore the last image if you use a new system.

Okay. My Get Key Display Name also has a Boolean input, Long Display Name (default yes), can I leave it as is? And what exactly do I connect to the key input? Getting IA_Interact only gives me a boolean if it’s active.