protected:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
class UButton* StartBtn;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
class UButton* QuitBtn;
virtual void NativeConstruct() override;
에디터에서 부모를 MainMenu 로 수정 , Name이 같지 않으면 에러 발생
버튼 클릭했을때 처리
void UMainMenuWidget::NativeConstruct()
{
if (StartBtn)
{
StartBtn->OnClicked.AddDynamic(this, &UMainMenuWidget::OnStartClick);
}
if (QuitBtn)
{
QuitBtn->OnClicked.AddDynamic(this, &UMainMenuWidget::OnQuitClick);
}
}
5.UWidgetBlueprintLibrary::SetInputMode_GameAndUIEx(UGameplayStatics::GetPlayerController(GetWorld(), 0), this);
UI 만 사용자 입력에 응답 할 수있는 입력 모드를 설정하고 UI가 처리하지 않으면 플레이어 입력 / 플레이어 컨트롤러가 기회를 얻습니다.
-> 왜써야 하는지는 좀더....
UWorld* World = GetWorld();
//MainMenuMap 맵 로드
UGameplayStatics::OpenLevel(World, TEXT("MainMenuMap"));
// 게임 종료
UKismetSystemLibrary::ExecuteConsoleCommand(World, TEXT("quit"));
//게임 잠시 멈충
UGameplayStatics::SetGamePaused(GetWorld(), true);
//다시 시작
UKismetSystemLibrary::ExecuteConsoleCommand(World, TEXT("RestartLevel"));