Load file for style

Hi,

I am currently creating an interface in UMG and I would like to create different styles for it, for example style_red, style_blue,… so that the main color of the UI is red or blue,…
I think it’s possible by “simply” putting a combobox and the choice of an item calls a function, in each blueprint of the project, which changes the style depending on the combobox item for example.
But this solution requieres that each blueprint has blocks to do things like :


if( style == "red") then (a lot of blocks to change all elements color in red)
else if( style == "blue") then (a lot of blocks to change all elements color in blue)
...

and the blueprint can become very big!

So I would like to know if it’s possible to have a file per style (style_red.css for example, don’t know which extension it will be in UMG), and when I choose an item in the combobox, I load the corresponding file, and finally update the blueprints’s style whith that file.
In blueprint, a block to do something like :


updateStyle("style_red.css")

Thanks.

nevermind what I wrote before… cant you bind the color of your elements with the same function? therefor you only have to change it in one function and all elements become red.

Yes you can bind that to same function.

That function can get current widget style, break it, change color only (get all other values copied over), build it back and give as result.

And then every umg widget can bind to dispatcher in player controller (because its easiest to get and cast to) that changes style.

However get color function updates every tick. With more widgets it may slow down everything.
If you have problems with performance from umg, do color change when dispatcher fires only. That means getting reference to all widgets, and doing for each loop. If they have different classes interface may be needed. Yes it gets complicated.

I have bit different setup for all widget stuff:
i created bunch of custom widgets (for eg evey interface state is separate custom widget). Every major widget hooks to player controller dispatcher. every minor widget inside that big one has blueprint interface that changes style (or collapses it etc). Then on event dispatcher i make array of all child widgets, and run for each loop that casts to INTERFACE and calls change style function. It does not matter if there are childrean that do not implement it they usually inherit style from parent, other that i created self have that interface implemented.

This way i can create my custom widget, add interface and drop it into major hud widget.

PS. sadly umg does not support blueprintable components, that would make everything very easy.