Alternative for the Back Button Challenge

I decided to make my cancel button more versatile.

I instead of going to main menu, i use the widget index and decrement it. That way, whatever menu i am in, the cancel button will return to the previously used widget.

void UMainMenu::Cancel()
{
	if (!ensure(MenuSwitcher != nullptr)) return;
	int32 CurrentIndex = MenuSwitcher->GetActiveWidgetIndex();
	CurrentIndex--;
	MenuSwitcher->SetActiveWidgetIndex(CurrentIndex);
}

Privacy & Terms