UnrealMultiplayer/2_Menu_System

Setting a member to itself - MenuInterface misssing a letter

Opened this issue · 0 comments

// Fill out your copyright notice in the Description page of Project Settings.

#include "MenuWidget.h"

void UMenuWidget::Setup()
{
this->AddToViewport();

UWorld* World = GetWorld();
if (!ensure(World != nullptr)) return;

APlayerController* PlayerController = World->GetFirstPlayerController();
if (!ensure(PlayerController != nullptr)) return;

FInputModeUIOnly InputModeData;
InputModeData.SetWidgetToFocus(this->TakeWidget());
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);

PlayerController->SetInputMode(InputModeData);

PlayerController->bShowMouseCursor = true;

}

void UMenuWidget::Teardown()
{
this->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;

}

void UMenuWidget::SetMenuInterface(IMenuInterface* MenuInterface)
{
this->MenuInterface = MenuInterface;
}