I’m getting an error I don’t understand.
I have a struct called FLilaParameter, which I have defined in a file called LilaStructsAndEnums.h:
LilaStructsAndEnums.h
USTRUCT(BlueprintType)
struct FLilaParameter
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FName ParameterName;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float Value;
FLilaParameter()
{
ParameterName = TEXT("ParameterName");
Value = 0.0f;
}
FLilaParameter(FName _ParameterName, float _Value)
{
ParameterName = _ParameterName;
Value = _Value;
}
};
…
In another class called LilaBrushDynamic, I want to have an array of these structs. Here is the code for that class:
…
LilaBrushDynamic.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "LilaBrushDynamic.generated.h"
struct FLilaParameter;
UCLASS()
class LILA_API ALilaBrushDynamic : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ALilaBrushDynamic();
TArray<FLilaParameter> ParametersArray;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
};
When I try to build, I get the following error:
Error C2139 ‘FLilaParameter’: an undefined class is not allowed as an argument to compiler intrinsic type trait ‘__is_trivially_destructible’
C:\Program Files (x86)\Epic Games\UE_4.17\Engine\Source\Runtime\Core\Public\Templates\IsTriviallyDestructible.h 18
What’s going on here? Why can’t I have an array of this struct that has been defined?