Easy way for challenge but not proper way

hi I changed my codes like this,that easy way but I know that is not the goal of topic::thinking:

   bool UInGameMenu::Initialize()
{
	bool Sucess = Super::Initialize();
	if (!Sucess) return false;

if (!ensure(CancelInGameButton != nullptr)) return false;
CancelInGameButton->OnClicked.AddDynamic(this, &UInGameMenu::CancelMenu);

if (!ensure(QuitInGameButton != nullptr)) return false;
QuitInGameButton->OnClicked.AddDynamic(this, &UInGameMenu::QuitGame);
return true;
}
 void UInGameMenu::QuitGame()
 {
	 UE_LOG(LogTemp, Warning, TEXT("it was clicked quit"))
	


 
	 UGameplayStatics::OpenLevel(GetWorld(), "ManMenu");

 
 }
 
 void UInGameMenu::CancelMenu()
 {
	 UE_LOG(LogTemp, Warning, TEXT("it was clicked cancel"))
		 RemoveFromViewport();
	 UWorld* World = GetWorld();
	 if (!ensure(World != nullptr)) return;
	 APlayerController* PlayerController = World->GetFirstPlayerController();
	 if (!ensure(PlayerController != nullptr)) return;
	 FInputModeGameOnly InputModeData;
	 PlayerController->SetInputMode(InputModeData);
	 PlayerController->bShowMouseCursor = false;
 }
1 Like

Not to be that guy…but being that guy. Your map is called ManMenu, not MainMenu. :rofl:

Privacy & Terms