Make a blueprint event happen when i press a button on my widget.

When i press a button on my widget i want to activate code in my actor component script (to add an item to inventory).
I have the feeling this should be extremely easy. (':


  • where / how is the widget created?
  • where is the actor that has the component the widget should talk to?

The widget is created upon interacting with an item (seen below it opens an inspect screen with a button option to take the item.)

Not sure what you mean by the second one?

The pic does not help.

Where, in the script, do you create the widget - inside which actor? Where, in which actor, is the component you wish the widget talked to?

The widget is created in a different BP (called inspectitem). I would like it to talk to my inventory but if it needs to also be in inspectitem thats fine.

That’s precisely what I’m asking about. We need to know where those actors, widgets and components are instantiated. How do they come into play, etc… It’s your job to tell the editor where things are. Once you know where things are, you can connect them and make them talk.

If the inventory is in the player BP:

Get character → cast to your character class → get Inventory component → call

An event dispatcher would be the best way to go id think

1 Like

Instead of casting to the class you may want to call get player character, then access the inventory component from there

1 Like

It would not be a great choice, tbh - you’d have to have every single interactive item register upfront, even thought the player may never interact with it. No need.

event dispatchers did give me a good start thankyou :))