Download

Widget switching crashes editor

Hi everyone,

It has been more than a week and there is still no answer on answerhub. Hope to have better luck here. Please go to:

https://answers.unrealengine.com/questions/607232/widget-problem-which-crashes-my-project.html

Garbage collection is likely whats causing the issue since you’re trying to remove them from the viewport when switching widgets vs just changing their visibility. Try the following code and if that doesn’t work, let me know and I’ll look into it further.



void AMyPawn::Button1()
{
	widget1->SetVisibility(ESlateVisibility::Collapsed);
	widget2->SetVisibility(ESlateVisibility::Visible);
	time = Cast<UTextBlock>(widget2->GetWidgetFromName(TEXT("Time")));
}

void AMyPawn::Button2()
{
	widget2->SetVisibility(ESlateVisibility::Collapsed);
	widget1->SetVisibility(ESlateVisibility::Visible);
	time = Cast<UTextBlock>(widget1->GetWidgetFromName(TEXT("Time")));
}


Thank you Chris. It works.

Hello Chris, you post saved me. After one day spent to understand why my program crashed randomly, I got your post.
Thank you very much.