Ok
The best Option would be if I explain the usage of my attempt.
First:
I want to create a User Interface Template so Designers can easily create UI
First I thought about using UMG but unfortunately I could not get the Interaction to work because of the switching from Game Input to UI Input Mode.
The “Game” uses the first Person template provided by you guys.
My attempt:
I created a base class UIElement which derives from USceneComponent which has an Update Method which just Sets the Width and the Height. This Function is virtual and can be overriden by the subclasses of UIElement (For Example:
UIButton overrides SetWidth and additionally corrects the BoxExtent of the BoxComponent UIButton creates (Theres also an Issue because Child Components won’t work correctly when initialized in the constructor of a Component. I hope you can help me too, with that :D. Component Hierarchy Issue)
The Width and Height Properties have the Specifiers EditAnywhere and BlueprintReadWrite.
Important Base classes of UIElement are:
InteractableUIElement (for example UIButton)
and LayoutUIElement:
LayoutUIElement are for examples HBoxes and VBoxes.
HBoxes align the UIElement which are attached to them horizontally and set the width and the height in dependency of their own.
simple example:
UIButton wants 50% Width
void UHBox::Update()
{
//...
UIButton->SetWidth(this->Width*0.5f);
//...
}
void UUIButton::SetWidth(float NewWidth)
{
Super::SetWidth(NewWidth);
BoxCollision->SetBoxExtent(FVector(1, Width, Height)*0.5f);
}
I hope this is the Information you Need to help me ![]()