Attaching UIComponent to the Root widget of a BP

Hello!

We just updated our engine version to 5.7.X and the UI team was eager to explore the new UI Component system. We’re just a little confuse as to why we can’t attach a UI Component to the root widget of a BP widget.

  1. Is there consideration to allow UI Component to be attached to the Root of a Widget BP?
  2. Is there a technical restriction that prevent this from being a reality?

We were expecting this to be like an Actor Component where you can build you component and give functionalities to the Actor BP.

Thank you!

Child-UIComponent.png(345 KB)
Root-UIComponent.png(366 KB)

Steps to Reproduce

  1. Create a Widget BP
  2. Select the Root of the Widget BP
  3. Notice there’s no way to attach a UI Component.

I don’t think I need to provide a repro project for this. I’ve attached image to show the issue.

Hello [mention removed]​,

As per documentation, the new UI Components are meant to be attached to actual UMG Widget elements as they are initialized with the widget they’re attached to.

(Reference: https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/UMG/UUIComponent)

1. To my knowledge and research, the purpose of these UI Components is to add reusable behavior to specific widgets (rather than act as Blueprint-level extensions like Actor Components do for Actors) and help simplify the hierarchy of the user interface.

2. Since Widget Blueprints are built around a Widget Tree where the Root is simply the top-level visual container and not an actual widget instance, we shouldn’t expect UI Components to be able to attach to it.

Generally, you may simply attach a UI Component to a bare Canvas Panel. Or, to give functionality to your BP Widget without having any widget elements at all, you may always put that logic in the Widget Blueprint itself.

Hope this helps! Please don’t hesitate to ask if you need further assistance.

Best regards

Tadas

Thank you for the answer! :slight_smile: