How to dynamically create an instance of a UWidget in Editor

Hi,

I’m in the process of learning Unreal and making a game. I want to create a general purpose Table widget. I decided to do it like this. There will be a Widget “Table” and it will have various settings like an array of “Columns”: an array of structs (is column editable, column contents type, etc). Ideally what I would like is that when the “Table” is used and the Columns variable is changed the UI is updated automatically: the columns and the table header are created or updated. And this can be seen in the editor by the designer. I tried to find info on how to automatically update Widget Editor content when the variable is changed but I failed to find it. So I decided to have a function able to be called in the editor to act as a button in Widget Editor to update the look manually.

But the next question is how do I dynamically create a say HorizontalBox in the Widget Editor using Blueprints or C++? I failed to find this either. I’m coming from Unity and it was quite easy to change Prefabs in the Editor. Can I do it in Unreal?

1 Like

I tried doing something like this. But this does not seem to work in the Editor. I tried with and without Add To Viewport

I actually found the exact solution to what I wanted to achieve on BenUi website. Great docs/tutorials website. There was specific article on that matter.

I wish though the official Unreal documentation were much better on the subjects of Slate and this kind of Editor scripting. Sadge.

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