I am trying to create a UI widget in unreal 4.7…
What i want here is that when the player clicks on any of the button on right the text button on left gets updated as well.
I tried to find a way so that i can dynamically create them on click of button but couldn’t get something workable… I could use a single string also to store the string for representation if I could be able to represent it vertically. But that also seems not available. Please help me out!!
For Example: String: “FWD-10 BKD-10 LFT-90 RGT-90”
Should be represented as:
Note: I want it to happen right when the user clicks on the button.
I did it something like this. One of my friend suggested this way. What do you think?
CMIIW, but until I write this, the default engine can’t create new class or object from blueprint, only pawning actor. So, you should use structure instead of using object as data structure. The only way to create new class or object is create it from C++ class. so you can create static function with object as it’s parameter then call it from blueprint.
Same goes for your current problem. The solution I offer to you is, instead of using textbox in widget, you can use draw text in HUD. Look at the content example from learning and read this documentation:
If you still insist with your way, then this is the way that I can suggest for you:
- Create 10 (or more, whatever you want) text in widget design
- Create an array with text as its variable types
- Add all the text in array (do it in order)
- Add event on mouse click from the button in widget graph
- Split the string using Parse Into Array function, not Spit function look at below link for documentation
- Make logic if the array from splitted string has length more than the available text, then it do nothing
- Otherwise, write to text using array of text created earlier, with the same index as array of string from splitted string
I hope it’ll help you out
That’s great! That’s something new for me too. Thanks for the share…