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:

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()
	time = Cast<UTextBlock>(widget2->GetWidgetFromName(TEXT("Time")));

void AMyPawn::Button2()
	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.