C++ structs not showing up in UE4 editor despite trying for hours.

Here is my code:

However, when I go in the UE4 editor to import a data table… the struct doesn’t show up as an option to select. Any ideas?

where did you create that struct ? is it part of another class or is it present in a separate file?

I’ve added that struct to my actor class and it didn’t show up in the editor. So then I added it to an empty c++ blueprint library and even that didn’t work either…

I know what I did wrong… I’m so mad. You need to include ’ : public FTableRowBase ’ after the FStructName… I saw no mention of this critical fact in any of the tutorials or examples I researched.

1 Like

are you saying that you inherited FTableRowBase into your struct…?
Instead of that create a c++ class from UObject as base class, remove all the inheritance code. Change UCLASS() to USTRUCT(BlueprintType) also change class to struct and make sure that struct name is prefixed with F. Here is an example code

[FONT=Courier New]#pragma once
#include “CoreMinimal.h”
#include “UObject/NoExportTypes.h”
#include “YourClassName.generated.h”

USTRUCT(BlueprintType)
struct YourProjectName_API FYourStructNameStruct
{
//some example variables
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FLinearColor Color;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 MaterialIndex;
};

If you create it this way not only in data tables but you can also use in any blueprint as a datatype

This is the code that ended up working as I expected it to:



USTRUCT(BlueprintType)
struct YourProjectName_API FYourStructNameStruct : public FTableRowBase
{
//some example variables
GENERATED_USTRUCT_BODY()

UPROPERTY(EditAnywhere, BlueprintReadWrite)
FLinearColor Color;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 MaterialIndex;
};

That struct can be placed in the header file of any class (player pawn etc) and it now shows up in the editor with the inclusion of the ‘public FTableRowBase’ section.

That’s because structs are intended to be a collection of data that can be used anywhere. You can use it as a variable in any of your classes even:


UPROPERTY(EditAnywhere) FYourStructNameStruct StructStuff;

And all of it’s data will show up nicely in the details panel (even works in arrays).

FTableRowBase only makes it available for data tables, that’s all.

1 Like