I am creating a 3D pop up UMG system and am running into a bit of a problem trying to set up a sorta custom resize of the layout in C++. I have gotten everything working like spawning the 3D UMG widget and component and have all my widgets inside a CanvasPanel and ScaleBox and am using the SetSize() function to resize my images and borders inside that Panel. My problem is that I cant seem to rezise the main UserWidget’s size. In the actual engine changing the Preview Size to Custom and setting it to something like 500,500 is all fine and dandy but how do I change this to use to use my own size in C++ , at runtime? I just cant seem to find the FVector2D anywhere to change it. I know I am missing something obvious
Any thoughts?
My code I have been using so far.
UCanvasPanel* Canvas = Cast<UCanvasPanel>(FoundWidget->GetWidgetFromName(FName(TEXT("Canvas"))));
UTextBlock* TextArea = Cast<UTextBlock>(FoundWidget->GetWidgetFromName(FName(TEXT("Text"))));
FVector2D TextSize = TextArea->GetDesiredSize();
if (TextArea != NULL)
{
TextArea->SetText(Text);
}
//I have tried this but it is not of type class CanvasPanelSlot so it does'nt have the function SetSIze() :(
// Cast<UCanvasPanelSlot>(Canvas->Slot)->SetSize(TextSize);
TArray<UPanelSlot*> SearchSlots = Canvas->GetSlots();
for (int32 b = 0; b < SearchSlots.Num(); b++)
{
//Cast and Set the Size of each Slot
UCanvasPanelSlot* widgetSlot = Cast<UCanvasPanelSlot>(SearchSlots[b]);
if (widgetSlot != NULL)
{
widgetSlot->SetSize(TextSize);
}
}