Download

How to Create Widget BP from Data table and Structure?

Hi! I am developing a really simple HUD for decision making in unreal engine 4.26.2. The player will get a question and he or she can choose a good answer from A,B,C or D. It will be working on a Pico VR headset but it’s not so really important this case. I already imported datas from .JSON files to Unreal. These datas should be imported into the widget. So now I have Data Table and Structure but I’m not really sure what is the best way t fill the Widget GUI (alias HUD) from Data Table and Structure. How to connect the blueprint ‘behind it’? I never worked with these in Unreal before so I really need some help. THank you in advance! Cheers, Máté

It all depends on how the data looks like and how it’s organised. Accessing it can be done directly from within the widget if simplicity is what you’re after:

Here the button would pull next data row providing rows are numbers.

There are many ways to make the above (much) better; too numerous to list without comprehending what the flow of the app / game is, though.

1 Like

Thank you really much for yourt answer, I really appreciate it!
So I will clarify what I need. Below I attached two pictures about my Data Table which contains yet only examples. You will see the filled datas and that every answers takes different points. On the other picture are the really basics about my Widget UI. It is about the player get a question and four choices with A,B,C and D. Basically the points shouldn’t show up in the widget menu.

So, I tried your graphs and my question is what is the method between Row name and Next Row? ANd where did you add SetText event to your BP?

Thank you in advance!


Not sure I understand what you mean by where. It’s all in the widget that displays it - something like this can be done in a single widget. Perhaps this bit is unclear:

image

Above, some widgets are not exposed by default but you can adjust it, so you can then directly set a text field like so:

image

the method between Row name and Next Row

Not really a method. Since I did not know what row names you were using, I assumed numbers. So the nodes would covert int → string → name. Not a very clasys move, I admit.


Your rows are Level00, Level01… But I’m still not sure what you really want to do here. We click an answer and then what? You must have some criteria dictating what’s right and what’s wrong and what’s next to display, surely.

Hard to advice without knowing more. As in,

  • I answer “What’s a sheep?”
  • how do we know what’s the next question - just the very next entry from the DT?

If you wanted something more advanced, I’d create a widget that represents a single question and have four of those widget added to a parent container. This way you can very easily adjust what and how each line displays its text.

When the next question gets selected, we feed those widgets relevant data.

Do tell if any this gives you a headache, I believe I could cobble something similar for you to take apart and take it from there.


edit: Thinking about it, I believe I’ve done it once or twice already, it’s somewhere on Answer Hub but I can’t find it, as per usual.

edit2: had to Google it, ‘quiz’ was the keyword AH could not handle:

https://answers.unrealengine.com/questions/834111/how-to-create-a-quizztrivia-game-only-using-umgbp.html

Sadly the project link is no longer valid, but there’s plenty of examples about handling something very similar.

Hope it helps a little but do tell if it does not.

Thank you again, it helped a lot!

Hard to advice without knowing more. As in,

  • I answer “What’s a sheep?”
  • how do we know what’s the next question - just the very next entry from the DT?

Agree I didn’t make it clear. I make a game which has different levels. Level means here different scenes, places where the player can moving, acting or just looking etc. And all the levels will be ended up by a question panel. Only one so not a lot of question should shown up in the end. For the questions I need the Data Table because it can be updated and easy to change outside the WidgetBlueprint. For each question belongs four answers (A,B,C,D). After someone has chosen one answer by clicking the controller (because as I mentioned all the game will be played in VR) a new (second) window will pop up and it asks “Will you confirm your answer? Y/N”. Next (third) panel is about processing after clicking Y/N button. Last (fourth) panel shows your decisions points. The points are shown in the previous screenshot in Data Table as AP, BP, CP and DP. In this case probably you have right, it is more like a quiz. I hope it’s much more clear now but ask if you have further question.
I try to look at over everything what you’ve sent. If you have any additional advice according to the game description please tell me. Thank you!

Thanks again! Now it seems like it works basicly.

I have an another question may you could help me. I’m using widget switcher and after the player has chosen from the A,B,C,D answers (on the first page) then after clicking the sign on the next page will confirm your choose. On this widget page I would like to display the chosen letter A,B,C or D. Any suggestion how to solve this?
Thanks!