I have a widget that when I open it in Editor, it causes it to crash, so I can’t even try to find what is causing it.
My main suspicion is that the preview of the widget is the problem, because when I try to open it, it crashes the editor but also when I am running the game and I get to the point where that widget is supposed to be created it causes the crash.
If this is the case it might be something inside PreConstruct call, as any widget that contains it, and is showing it also cause the crash.
So to get to the problem, how can I open the widget with the preview disabled, meaning I need to either disable Designer tab completely, or have a way to open straight into Graph?
The 2nd option might not work still as I think in background the Designer will still try to create the preview.
One way to do it is if you know a function that Widget is calling from another one, you can find references where that function is used, and that way you get straight into graph at the place where it is used.
They should really make it so that Edit opens the Graph directly, as that way you can get past problems like this.
If it is crashing in PreConstruct, then one problem can be that in UE 5.7 this call from blueprint can cause the crash:
Because the engine doesn’t have a function to change only the font for an EditableTextBox, you have to resort to changing the font by setting the style.
What I recommend is that you make a C++ function that changes the font and call that. You can make a blueprint function library by opening Tools in Editor, then New C++ Class.., and from that list at the bottom choose blueprint function library.
In .h file of a blueprint function library you want add this after GENERATED_BODY() and with public: line before it:
UFUNCTION(BlueprintCallable, Category = “.My Functions”)
static void setFont(UEditableTextBox* editableTextBox, const FSlateFontInfo& font);
Then in .cpp of the same blueprint function library add this:
void UEditableTextBoxBFL::setFont(UEditableTextBox* editableTextBox, const FSlateFontInfo& font) {
FEditableTextBoxStyle style = editableTextBox->WidgetStyle;
style.TextStyle.Font = font;
editableTextBox->WidgetStyle = style;
editableTextBox->SynchronizeProperties();
}
Then from editor you can simple call it:
Where font in the editor is of type Slate Font Info.
Yeah it seems that was the problem in my case as well, and making that C++ function fixed the problem. Thank you!