x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Using Widget Style Assets with UMG

Hi there,

In Unreal 4.5 we now have the ability to set the style of widgets either as a default in the UMG Editor or as part of the graph with a blueprint function.

We also have the ability to create Slate Widget Style assets. However there doesn't seem to be a way to use these to set the style of widgets in UMG.

I noticed The UButtonWidgetStyle is a Blueprint Type, but the other styles are not, which means you cannot use them in blueprints. Why is this?

The assets themselves are USlateWidgetStyleAsset which also cannot be referenced via blueprints.

Allowing us to use the asset styles, mean we can share the same style between screens and only need to make changes in one place.

Is this a coming feature? Is there a way I can do this now?

As a note here is what I mean regarding the Button Widget Style Asset being in blueprints:

alt text

Product Version: UE older version
Tags:
umgwidgetstyle.png (48.1 kB)
more ▼

asked Oct 15 '14 at 05:06 AM in Bug Reports

avatar image

Ben.Driehuis
496 18 27 142

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Style assets are not really intended to be used with UMG any more. Those styles exist because they were developed before UMG, and are still being used by game teams using raw slate. All styling in UMG is currently done with inlined styling, however that is also temporary.

The long term plan is to make styling reusable, but not the way it was. The plan is to make style classes, that can be extended via blueprints or C++ and contain behaviors, allow bindings...etc. As opposed to what they are now, which are just flat structs with no way to encode behavior or additional data. Even if you could reuse a button's style right now, it's still not good enough. if you want all buttons to look a certain way AND scale on hover, you've got to duplicate the logic which isn't good.

I don't have a timeline for the revamp to styles, but we know it's a problem and we have a plan to replace them. Won't be in 4.6, we already have a ton of things lined up for that release.

If you need something to be reused a lot, I recommend making the widget a user control that's just a button or whatever so that you can reuse the style and behavior information. In 4.6 Named slots will make it way easier to re-use user controls by allowing you to expose slotable areas on user controls so that you don't have to bake out a button that already has text, or an image. You just make a user control that's a button with a slot.

Cheers, Nick

more ▼

answered Oct 15 '14 at 12:46 PM

avatar image

Nick Darnell ♦♦ STAFF
6k 77 37 151

avatar image Ben.Driehuis Oct 17 '14 at 01:13 AM

Thanks for that Nick! Lots of good info there.

avatar image MyFreshP Sep 22 '15 at 03:55 PM

I'm using 4.9 and the UMG designer for my UIs and it is very annoying to change every button (and other components) manualy.

Due to the given info I didn't use Ben.Driehuis method. What is the best way to use the same style for all the buttons (at least on one screen)? I'm tired of making changes several times just because I have several buttons.

avatar image RVillani Dec 31 '15 at 02:00 AM

Hi, Nick! Are there any news on the Style Classes? Thanks!

avatar image Rudy Q ♦♦ STAFF Jan 14 '16 at 02:34 PM

Hello RVillani,

If you would like to reuse styles you could set up a widget and pull off a reference to it to grab it's style. From there you could promote the style to a variable that can be called and reused. You could also create a widget and then add this widget to other widgets via the user created section. I hope that this information helps.

Make it a great day

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I'm using 4.9 and the UMG designer for my UIs and it is very annoying to change every button (and other components) manualy.

Due to the given info I didn't use Ben.Driehuis method. What is the best way to use the same style for all the buttons (at least on one screen)? I'm tired of making changes several times just because I have several buttons.

more ▼

answered Oct 06 '15 at 08:04 PM

avatar image

MyFreshP
44 3 54 12

avatar image Slavq Oct 29 '15 at 12:28 PM

Same problem here.

You can create a 'parent' widget with desired style and then derive from it (so instead of creating a new button, you create new widget from 'User Created" section in UMG, selecting this 'parent' button) - but it has some caveats, more info here: https://forums.unrealengine.com/showthread.php?82842-Universal-UMG-widget-parent-for-reuse-default-variables-preview&p=409723#post409723

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

So in the end due to the original response I ended up coding my own style solution, making a blueprintable class for each control type and having most of the same data as the old styles in there. I then had to extend each of the UWidget classes for the ones I cared about (UButton, UTextBlock etc) and allow them to have a TSubClass of the correct style class, and then wrote some code to take that and apply it to the underlying Slate Widget.

I also made it that any changes to the actual properties on the UButton (Etc) would override the style for that property only. A bit of extra grunt work, but did what we needed it to do.

If anyone else wanted to try such a thing I am happy to share some pointers, of course you need a code based project for this.

more ▼

answered Jan 11 '17 at 03:28 AM

avatar image

Ben.Driehuis
496 18 27 142

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Another solution to this would be to not have the text be part of the button, instead use an overlay to put it on top of the button user widget and set the text visibility to "Hit Test Invisible".

This way changes to the button still affect all of them but the text is separate. Of course the drawback is that the text is not styled from the button so you still have to do that manually.

Example Hierarchy:

alt text

(I know this is an old question but it still comes up as one of the first results when googling this issue so wanted to help out people that are still having these issues)

hierarchy.png (15.6 kB)
more ▼

answered Jul 23 '16 at 05:40 AM

avatar image

pr4wl
84 7 16 21

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question