Hi, I’m working on Editor Utility Widgets, it’s really annoying that if widget shows up, it doesn’t have fixed size. Is there a way to fix the size of widget? Or set maximum/ minimum size…
I need the same feature. Did you find a solution?
I’m looking for a solution to this as well if anyone has found one.
Also looking for a solution
I had this problem and still technically do.
But looking at how other editors work when scaling I tried to replicate that. I ended up using a bunch of parent border boxes with fixed anchors at a corresponding corner of my widget. This way scaling up and down the window somewhat keeps the proportions and interactive elements on screen. Check how the MRQ works at scaling the window. I hope I get the question right. If it’s something else, the excuse me for the confusion. Cheers,
I’m surprised there is no official solution yet. Well, I hope I can somehow bump this post. I too am facing this issue.
still need an answer
It can be done!
You can find the window of the utility widget (SWindow) and resize it.
This is how I do it:
UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>();
if(!EditorUtilitySubsystem) {return;}
UEditorUtilityWidget* SpawnedMenu = EditorUtilitySubsystem->SpawnAndRegisterTab(MyUtilityWidget);
SpawnedMenu->ForceLayoutPrepass();
TSharedRef<const SWidget> CachedWidget = SpawnedMenu->GetCachedWidget()->AsShared();
TSharedPtr<SWindow> TabWindow = FSlateApplication::Get().FindWidgetWindow(CachedWidget);
//A Slight delay to make sure the widget is rendered
FTimerHandle Timer;
SpawnedMenu->GetWorld()->GetTimerManager().SetTimer(Timer, FTimerDelegate::CreateLambda([=]()
{
TabWindow->Resize(TabWindow->ComputeWindowSizeForContent(
CachedWidget->GetDesiredSize()));
}),
.35, false);
Is there a BP version of this solution?