Using an External file to Create Widgets

Hi all,

I’m bringing my game from Unity over to Unreal and there’s one tiny missing piece I’m a bit stumped on.
It’s has a rhythm component to it where a UI element has 4 rows defined.
(The closest thing I can compare it to is DDR except instead of arrows being spread out horizontally, they’re spread out vertically, kinda like below)





I used an external file (basically a text file) with values for each “note”. Each note would have an X and Y attribute, X for which row it would spawn on and Y for the time along the table it would spawn at.
(Eg at 0:20 seconds, spawn Note 1 at Row 1/X = 1, 0:23 sec, spawn Note 2 at Row 2/X= 2 and so on)
I was able to use that “Rhythm Table” as an object to attach to different characters based on what song was playing.

What I’m stumped on is that if it’s possible to do this within UE and what does that look like or even what should I be looking at to achieve this?
Are my options that I can do it in either Blueprint of C++? Or only c++?
I’m open to even approaching this a completely different and better/more efficient way that I haven’t even thought about!

Thanks in advance!

Ok kinda figured out how I’m gonna do it but hit another snag.
I’m storing the “note” widgets in a datatable and attempting to spawn them once the rhythm table pops up.
The problem I’m seeing is that it’s definitely fetching the widgets, but I’m not sure if it’s actually creating/spawning them on screen as nothing is added to the viewport it seems.
Is there something specific I’m missing when it comes to spawning a widget from a datatable?


Did you add them to the viewport?

Should work like a charm, things to consider for debugging:

  • visibility of the widget and its elements
  • are you adding to the viewport or as children of some other container - in which case double check container’s visibility and whether it’s in the viewport already
  • are you positioning the widgets in any specific way - they could be spawning outside of the viewport, for example due to some offset miscalculation
  • when you say “definitely fetching”, how are you checking it
  • do you have any other UI elements that could obstruct the widgets or mess up their Z order

I could go on but it’d be easier if you showed how you spawn & add to the viewport, a sneak-peek at the widget in question wouldn’t hurt either.

So I went back after reading this and went through your steps just incase I missed something!

  • First thing I went back and checked to see if the containers were “visible” first by checking their visibility (just output to print string) and also filling each row with an image. Checks out.
  • The notes can spawn individually to one of four rows, I checked if they were also in viewport (just incase) and they seem to be fine.
  • I’m just testing by adding to its child. So no offset positioning as of yet.
  • I spat out (after the note is spawned) a display name. Probably bad practice but at least if it doesn’t exist/didn’t spawn then it’d be null.
  • Probably the rhythm table itself. But I tried setting the rows at a higher index, but no change.

So this all got me thinking if the notes themselves are added to the viewport. NOPE.
I’ll post the rhythm table and logic below.

So this is the rhythm table. Pretty basic but the two things of note here are the Row container and the rows themselves.
The row container is the canvas panel that wraps around the 4 rows.
When the Rhythm Table is spawned (from the battle system), the Rows (row container) object will automatically start moving to the left.
I had tried to spawn a single note (with out a data table) and it seemed to work fine with that system.
Things started to go awry when I introduced a datatable of notes.

So the logic is pretty straightforward;
When the table is created, loop through the datatable (RhythmChartTest in this case) and get the note class and row position.

Create that note (for the Player Controller) set its row position (no functionality here yet for that, I’ll be using that to dynamically position a note to its row eventually), add it to its assigned Row (in this case Just the 1st row), add that note to the viewport and just to be safe, set that note’s visibility to …well Visible.

It…seems right the way I’ve done it but maybe there’s something I’m missing in between?
What do you guys think?

The first thing I noticed is that you add the widget as a child of another container [row1] and then immediately add the same widget to the viewport as well. This is not needed and will most likely do strange thing. As long as Row1 is in the viewport, any of its children are automatically shown, too - unless they’re invisible but you took care of that.

So what is the current status, what is working and what is not?

So the only thing that’s not working right now are the Note Widgets being added to viewport

You’ll see above that there are 4 false outputs, that’s the above where I’m querying is the current note created is in the viewport.
Also, of course! I totally missed that part haha I took out the add to viewport after the add child node.

But that still leaves the question, if they’re added to a row that’s clearly in the viewport, why aren’t the notes in the viewport? I get the feeling that there’s a simple solution to this that I haven’t thought about yet.

EDIT: Good news! I’m an idiot! I was supposed to use the Note class which inherits from Note Widget (a c++ which in turn inherits from User Widget), when in fact I used the Note Widget class.
So basically my own backwards naming conventions ended up biting me right back.

Thanks for all your help guys!