Sending a string from a actor blueprint to a widget
So I have been trying to create a digital watch for my character to wear and I have set up a working day and night system with a timer that counts hours, minutes and seconds which is saved in a string which displays HH:MM:SS.
I need to try send this string to a widget that will attach to the players watch so you can see the time when looking at the wrist (or on clocks ect).
I have tried to reference the blueprint within the widget which turned out a "accessed none error".
It wont be attached the the HUD like what most tutorials show since it will be a 3D widget attached to the characters wrist or to a clock mesh.
I have created a text box within the widget and then bind to it, but I am lost from there. What would be the best way to tackle this problem? It may be a simple issue but for the life of me I cant sort it.
Okay, I have been working with widgets for a couple of days and I can tell you how I did it. However I'm a newbie, so there might be simpler solutions.
First you need to store your Widget right after creating it in a variable (your Widget's class name, not the Widget class) to be able to access its public functions later. Then, inside your Widget, you create a String variable and a public function, which sets the variable to the function's input (which is also a String variable). Then you can call this function from the actor you saved the Widget as a variable in earlier, passing the desired String to the String variable inside your Widget - there you can access it.
Note: If the actor that spawns the widget is not the same actor which has the string you want to pass, it might get even more complicated.
Hope this helps!
answered Aug 02 '16 at 05:46 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here