Can't add any Widget to screen from C++ or Blueprint

I did update my project from UE5.0.3 to EU 5.1, and I can’t open ay widget from C++ or from blueprint.

I did a debug in the Blueprint and shows that the widget are not visible when I add it

Visual Studio gives me this error when trying ton compile the code:

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB3073	The command ""D:\Epic Games\Epic Games\UE\UE_5.1\Engine\Build\BatchFiles\Build.bat" NOMEditor Win64 Development -Project="E:\UE\5S\NOM 5.1\NOM.uproject" -WaitMutex -FromMsBuild" exited with code 6.	NOM	D:\VS2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets	45	

here are my C++ gamemode
h:

// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "NOMGameMode.generated.h"

UCLASS(minimalapi)
class ANOMGameMode : public AGameModeBase
{
	GENERATED_BODY()

public:
	ANOMGameMode();
};


cpp:

// Copyright Epic Games, Inc. All Rights Reserved.

#include "NOMGameMode.h"
#include "NOMCharacter.h"
#include "UObject/ConstructorHelpers.h"

ANOMGameMode::ANOMGameMode()
{
	// set default pawn class to our Blueprinted character
	static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter"));
	if (PlayerPawnBPClass.Class != NULL)
	{
		DefaultPawnClass = PlayerPawnBPClass.Class;
	}
}

Does anyone know how to fix this?

EDIT:

I was able to fix the error, but Unreal Engine still can’t display any widgets

I found the solution.
you need to add Super::Init(); to the firt line in the GameInstance cpp file under your Void Init

void YourGameInstance::Init()
{
	Super::Init();

	Your Code Here
}
1 Like