Expose "Space" of WidgetComponent in C++.

The “EWidgetSpace Space” of UWidgetComponent is protected and cannot be set when constructing it as a subobject in C++.

This means for every BP implementation I need to manually set it to Screen space.

My request: expose this when constructing in C++.

Example:

WidgetComp = CreateDefaultSubobject<UWidgetComponent>(TEXT("Widget"));	
//WidgetComp->Space = EWidgetSpace::Screen; // Set space to "Screen" in Blueprints
WidgetComp->RelativeLocation = FVector(0, 0, 0);
WidgetComp->SetDrawSize(FVector2D(800, 300));
WidgetComp->SetMaxInteractionDistance(0);
WidgetComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
WidgetComp->AttachParent = RootComponent;

Hello Tom,

I have gone ahead and entered a feature request for you, UE-21896. Thank you for your feedback.

Have a great day,

Sean Flint

+1 I just came here looking for a solution to the same problem.

I haven’t tried this but I might. Once solution might be to extend the widget component class and add a setter for Space.

+1 I’m just creating widgets in runtime and this would be great.

I can see function in 4.11 Prev 8 - SetSpace. So it will be there in 4.11