Download

Problem defining table rows for CSV data

I’m trying to follow along with the tutorial here: https://docs.unrealengine.com/latest/INT/Gameplay/DataDriven/index.html

I’ve created a file called ‘LevelUpData.h’ and placed it here: [Project]/Source/[Module]/Public

It contains the same content from the above page:


/** Structure that defines a level up table entry */

#pragma once

#include "Engine/DataTable.h"
#include "LevelUpData.generated.h"

USTRUCT(BlueprintType)
struct FLevelUpData : public FTableRowBase
{
    GENERATED_USTRUCT_BODY()
    
public:
    
    FLevelUpData()
    : XPtoLvl(0)
    , XP(0)
    {}
    
    /** The 'Name' column is the same as the XP Level */
    
    /** XP to get to the given level from the previous level */
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=LevelUp)
    int32 XPtoLvl;
    
    /** This was the old property name (represented total XP) */
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=LevelUp)
    int32 XP;
    
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=LevelUp)
    TAssetPtr<UTexture> Asset;
};

And yet, when I try to import a CSV file, there are only the standard two options under ‘Choose DataTable Row Type’: GameplayTagTableRow and AttributeMetaData

So obviously, the custom table rows haven’t registered properly.

What am I doing wrong?

Thanks!

Just too make things clear… Do you have your code compiled? I see only this reason, why your struct didn’t show up.

Ah, how exactly do I do that?

I created the file in Xcode, then saved it. And then closed and re-opened the Unreal Editor. Is there something more I need to do? (Sorry, only been using Unreal for about a week or so).

Try putting in the PROJECTNAME_API after struct, for example, the GAMEPLAYABILITIES_API for AttributeMetaData

struct GAMEPLAYABILITIES_API FAttributeMetaData : public FTableRowBase

Well, I can’t help you much with XCode usage, I haven’t used it much. But there should be a button called “Compile” in Editor itself. It is located in the top bar between “Build” and “Play” buttons.

Thanks for your comment/responses.

I actually managed to achieve what I was after by creating a struct that had the same variables as there were columns in the csv and importing it after that, which is a much simpler approach.

Thanks!