Dynamically adding children to ScrollBox adds all of them to the first line (blueprint)

Dear forum,

I’m at my wits end. What I’m trying to do is pretty straightforward and there are many tutorials on the topic (and code/BP snippets). I’m trying to go over the array and display its item in the ScrollBox. This is the BP, that is doing the adding to ScrollBox.

As you can see, I’m constructing the NewWidgetBlueprint, which is a User Widget with one Text widget. You can see the hierarchy here:
image

When there is one item in the array, everything looks good, there is one item in the ScrollBox:
image

The problem is, when there are multiple items in the array. The visuals of the NewWidgetBlueprint are all placed on the first line within the ScrollBox. The items are definitely in the ScrollBox as there is a scrollbar visible. But they are all displayed on the first line (you can see that they overlap each other, as the font appears to be much bolder that it is in the previous image):
image

I have tried to put VerticalBox, WrapPanel and all sorts of ordering widgets to ScrollBox and tried to add the NewWidgetBlueprint there, but the result is still the same.

Please help!

A rookie mistake :). In case, somebody has the same problem:
You are probably updating your ScrollBox in EventTick, which doesn’t leave UE time to process and properly place you child items within the ScrollBox. You should use SetTimerByEvent and then do the update of ScrollBox. In other words, do this:


instead of calling it each tick…

Please do not do this - rather than allowing the timer to run, you reset it 10x per second. Consider the following:

Or simply:


Also, is there a reason to do what you do 10x per second? Perhaps it would make sense to adopt an Event Driven approach and run it only once - or whenever you need it.

Thank you for your response and explanation, it helped me a lot. I’m not using event driven logic because I haven’t found a way how to monitor changes to an array (in the widget I’m displaying consists of several arrays). Theoretically I could bind the widget update to an event, that would be fired every time an array would be updated. But… I haven’t found a clear way how to do that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.