Download

Unrecognized type 'TList' - type must be a UCLASS, USTRUCT or UENUM

Hello guys!

I was trying to use a TList, but some reason I’m getting this error:



1>------ Build started: Project: FPSGame, Configuration: Development_Editor x64 ------
1>Parsing headers for FPSGameEditor
1> Running UnrealHeaderTool "D:\GAME DEVELOPMENT\PROJECTS\UDEMY\LATEST\StealthGame_ProjectBase_4.25\StealthGame\FPSGame.uproject" "D:\GAME DEVELOPMENT\PROJECTS\UDEMY\LATEST\StealthGame_ProjectBase_4.25\StealthGame\Intermediate\Build\Win64\FPSGameEditor\Development\FPSGameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="C:\Users\ShanxTadeu\AppData\Local\UnrealBuildTool\Log_UHT.txt" -installed
1>D:/GAME DEVELOPMENT/PROJECTS/UDEMY/LATEST/StealthGame_ProjectBase_4.25/StealthGame/Source/FPSGame/Public/FPSObjectiveWidget.h(36): error : Unrecognized type 'TList' - type must be a UCLASS, USTRUCT or UENUM
1>D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command ""D:\Program Files\Epic Games\UE_4.25\Engine\Build\BatchFiles\Build.bat" FPSGameEditor Win64 Development -Project="D:\GAME DEVELOPMENT\PROJECTS\UDEMY\LATEST\StealthGame_ProjectBase_4.25\StealthGame\FPSGame.uproject" -WaitMutex -FromMsBuild" exited with code 6.
1>Done building project "FPSGame.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



And here is the code:

.h



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

#pragma once

#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "Containers/List.h"
#include "FPSObjectiveWidget.generated.h"

/**
*
*/

struct FObjectiveMessage;

USTRUCT(BlueprintType)
struct FObjectiveMessage {

//GENERATED_USTRUCT_BODY()
GENERATED_BODY()

UPROPERTY(BlueprintReadWrite, Category = "Data")
FString Text;

FObjectiveMessage() {}

};

UCLASS()
class FPSGAME_API UFPSObjectiveWidget : public UUserWidget
{
GENERATED_BODY()

protected:
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
TList<FObjectiveMessage> ObjectiveList;

UPROPERTY()
FString CurrentObjectiveMessage = TEXT("");

UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
class UTextBlock* ObjectiveMessage;

protected:

virtual void NativeConstruct() override;

};



.cpp



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


#include "Components/TextBlock.h"
#include "FPSObjectiveWidget.h"
#include "Containers/List.h"

void UFPSObjectiveWidget::NativeConstruct()
{
if (ensureMsgf(!ObjectiveMessage, TEXT("")))
{

}
}


.
Do you have any clues? UE4 API documentation lacks information, and I didn’t find any examples around the internet.

Thanks!

Ps: I know that I can use TArray, but I’m trying another container.

I don’t believe you can have a TList as a UPROPERTY. Only TArray / TMap.

You’re right indeed, good sir!

Thank you!