Download

[UMG] Style sub widget based on state of parent?

I have a UMG button with proper styling based on state. However I also need some of its child widgets to also change based on the state of the button. Specifically I need to change the color of some text (not all) that is parented under the button. When the button changes between normal and hovered state I need to change the color of one of the text widgets in the button.

I can’t seem to figure out how to do this.

Ok I managed to get it working but I’d love to know if there is a more efficient way of doing this through UMG itself somehow. Similar to hot the button is done.

Anyway what I did was go into my widget’s graph and add a Tick event. In that I look each tick to see if the button widget “Is Hovered” or not, and set the color of the underlying text widget as needed. In order to do this I first had to tick the very easy to miss “Is Variable” checkbox at the very top of the Text widget’s properties. This then exposed it to the BP graph.