How to use a 3D widget component to affect the level blueprint?
I'm trying to make an interactive computer screen element in my game, and I've used 3D widgets to act as the terminal displays. The problem I have is - how do I get button events in the widget blueprint to affect the level? I want the player to be able to press a button whilst possessing the terminal, and have it turn on a light. I basically just want to get the widget button to affect the level blueprint.
Here is what I have so far. I have a Pawn Blueprint called 'Terminal.' This has the model of the terminal in it with the widget component attached to the screen. The player possesses this pawn to use the terminal's controls and the widget.
The widget blueprint used by the above widget component is called 'Interface', Button events originate here, but I can't seem to get them to affect the level, because they are not technically in the level, they are components of the 'Terminal' pawn blueprint class.
Finally, I have the level blueprint, where the functions for turning the lights on and off are. The 'Get' variable I created to point to the widget component is empty, because it can't be selected in the level (because it's contained in the Terminal BP)
I'm sure the solution is probably very simple, but I am very new to BP scripting, so any help figuring this out would be greatly appreciated!
asked Oct 14 '16 at 06:10 PM in Blueprint Scripting
I would recommend you use the Event Dispatchers to handle this.
As a quick test I created an event dispatcher in the pawn. Then in the level I can call it, or vice versa.
The trick may be in locating your pawn object reference from the level blueprint. You can either use the editor and place a fixed reference, or do a lookup on the scene.
answered Oct 15 '16 at 01:22 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here