Alternative Solution for Creating Back Button Challenge

You don’t need to new function or bindings.

void UMainMenu::OpenJoinMenu()
{
	if (!ensure(WidgetSwitch != nullptr)) { return; }
	if (!ensure(JoinMenu != nullptr)) { return; }

	// Check current widget
	if (WidgetSwitch->GetActiveWidget() == JoinMenu)
	{
		WidgetSwitch->SetActiveWidget(this); // this = main menu - widget 0 index
	}
	else
	{
		// you can active this method (it's safety) or you can active with widget index.
		WidgetSwitch->SetActiveWidget(JoinMenu);
	}
}
1 Like

Thanks for sharing. It’s always good to see alternative approaches.

1 Like