I have a variable I need to send from Level Blueprint to a Widget. The integer (array index) is a variable for switching characters. The widget has character creation menus for those characters. The problem is, I haven’t found a way to send the array index (or actor references) to the widget so I could synchronize it with the characters.
Is there a way to send an integer and/or actor references from level to widget? Thanks in advance
You can do this through various things. I assume you’re working on a singleplayer game, so this is what I recommend:
- Have your Level Actor be a Blueprint actor, and when triggered, it executes the following:
- Get Player Controller (index 0), and cast to your custom player controller class.
- In this class, have an event. This event is executed from the Blueprint actor in the Level (that calls to it)
Before you continue, there are a couple of things you want to set up:
- When you spawn your widget, save it as a variable
- Make an event with the name that you want to execute
- Make an event inside your Custom controller class that references this event that is inside your Widget BP.
Going back to the event now:
- In this event (now in your custom controller class), execute the event that references this event.
You have now a way of communication between an actor in the world and the Widget you spawned.