Error on CreateWidget()

Hi , in this part of Simple Shooter tutorial I was following the code to create a widget.
however compiling gives error.
I could not figure out what is going wrong.
could anyone help?

log message:

Building SimpleShooterEditor…
Using Visual Studio 2019 14.29.30136 toolchain (d:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.19041.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Building 4 actions with 12 processes…
[1/4] ShooterPlayerController.cpp
C:\UnrealProjectFast\SimpleShooter\Source\SimpleShooter\ShooterPlayerController.cpp(12): error C2672: ‘CreateWidget’: no matching overloaded function found
C:\UnrealProjectFast\SimpleShooter\Source\SimpleShooter\ShooterPlayerController.cpp(12): error C2440: ‘initializing’: cannot convert from ‘TSubclassOf’ to ‘TSubclassOf’
C:\UnrealProjectFast\SimpleShooter\Source\SimpleShooter\ShooterPlayerController.cpp(12): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
The terminal process “C:\WINDOWS\System32\cmd.exe /d /c Engine\Build\BatchFiles\Build.bat SimpleShooterEditor Win64 Development C:\UnrealProjectFast\SimpleShooter\SimpleShooter.uproject -waitmutex” terminated with exit code: 6.

Terminal will be reused by tasks, press any key to close it.

my ShooterPlayerController.cpp is as following:

#include “ShooterPlayerController.h”

#include “TimerManager.h”

#include “Blueprint/UserWidget.h”

void AShooterPlayerController::GameHasEnded(class AActor* EndGameFocus, bool bIsWinner)

{

Super::GameHasEnded(EndGameFocus, bIsWinner);



UUserWidget* LoseScreen = CreateWidget(this, LoseScreenClass);

if (LoseScreen != nullptr)

{

    LoseScreen->AddToViewport();

}

GetWorldTimerManager().SetTimer(RestartTimer, this, &APlayerController::RestartLevel, RestartDelay);

UE_LOG(LogTemp, Warning, TEXT("We have finished."))

}

cannot convert from TSubclassOf<UUserwidget> to TSubclassOf<UUserWidget>

You have misspelt UUserWidget

ahhh, my stupidity.
thanks a bunch, Dan!!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms