Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a member to itself - MenuInterface misssing a letter #1

Open
SkinnyBruv opened this issue May 28, 2021 · 0 comments
Open

Setting a member to itself - MenuInterface misssing a letter #1

SkinnyBruv opened this issue May 28, 2021 · 0 comments

Comments

@SkinnyBruv
Copy link

// 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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant