Driving Gameplay with Data from Excel

Issues with Structs

[=;135015]
It appears Row Names can only be numerical at this time…is it possible to allow any name in the future? It would seem that it would make sense since the type is ‘FName’ but if I put anything put numbers in that column the whole thing completely breaks.
[/]

Just a thought , but it seems like the primary reason that there are issues with using data tables in BP is not that the data tables themselves are screwed up, but that the struct BPs are a little flakey at the moment.

It seems that the “Get Data Table Row” blueprint node breaks every time I reopen the editor. If I select the Datatable and row I can use the data from the row pin, but once I save, close and then reopen the editor the row pin will be “invalid” (i.e. I cant break it and I there is also no “split” option when I right click it). The node still shows the correct data table asset (it will also find it if I click on browse) and the correct row name(s), but I have to re select the Data Table asset to be able to get a value from the row pin again. Is there something specific I have to look out for for this to work?

[=Froghut;187127]
It seems that the “Get Data Table Row” blueprint node breaks every time I reopen the editor. If I select the Datatable and row I can use the data from the row pin, but once I save, close and then reopen the editor the row pin will be “invalid” (i.e. I cant break it and I there is also no “split” option when I right click it). The node still shows the correct data table asset (it will also find it if I click on browse) and the correct row name(s), but I have to re select the Data Table asset to be able to get a value from the row pin again. Is there something specific I have to look out for for this to work?
[/]

Are you using a Blueprint struct or a C++ struct? GetDataTableRow is broken with Blueprint structs. I haven’t tested it with C++ structs, but I suppose it should work because when I looked at the bug it was caused by the blueprint struct being loaded after the GetDataTableRow was instantiated, which reverts the output pin back to the default TableRow type and breaks the connection.

Supposedly, it’s fixed in 4.6, but I haven’t verified it.

[=Froghut;187127]
It seems that the “Get Data Table Row” blueprint node breaks every time I reopen the editor. If I select the Datatable and row I can use the data from the row pin, but once I save, close and then reopen the editor the row pin will be “invalid” (i.e. I cant break it and I there is also no “split” option when I right click it). The node still shows the correct data table asset (it will also find it if I click on browse) and the correct row name(s), but I have to re select the Data Table asset to be able to get a value from the row pin again. Is there something specific I have to look out for for this to work?
[/]

[=;187198]
Are you using a Blueprint struct or a C++ struct? GetDataTableRow is broken with Blueprint structs. I haven’t tested it with C++ structs, but I suppose it should work because when I looked at the bug it was caused by the blueprint struct being loaded after the GetDataTableRow was instantiated, which reverts the output pin back to the default TableRow type and breaks the connection.

Supposedly, it’s fixed in 4.6, but I haven’t verified it.
[/]

Has anyone verified the fix for this in 4.6?

I can verify the fix. I no longer have to reset the DataTable structs each time, the pin stays connected, no more compile errors.

[=RhythmScript;187562]
I can verify the fix. I no longer have to reset the DataTable structs each time, the pin stays connected, no more compile errors.
[/]

Excellent. Thanks for your response RhythmScript.

Does anyone know the proper syntax for referencing an actor class in a table? I can reference the blueprint Asset that defines the class, but this appears to simply be a reference to the asset, and not the actual class itself.

Long story short, I want to be able to get a reference to an actor class from a table and spawn them.

I’d love to know that as well, also whether or not there’s the ability to include an array of elements (like a list of variable length of connected levels).

[=;204165]
Does anyone know the proper syntax for referencing an actor class in a table? I can reference the blueprint Asset that defines the class, but this appears to simply be a reference to the asset, and not the actual class itself.

Long story short, I want to be able to get a reference to an actor class from a table and spawn them.
[/]

I use a FStringAssetRefrence for Blueprints and TAssetPtr for other assets.
There is a good example on it Data Driven Gameplay Elements.

[=;204165]
Does anyone know the proper syntax for referencing an actor class in a table? I can reference the blueprint Asset that defines the class, but this appears to simply be a reference to the asset, and not the actual class itself.

Long story short, I want to be able to get a reference to an actor class from a table and spawn them.
[/]

Try using TAssetSubclassOf<AActor>. It stores the reference to an asset class (you have to load it using using LoadClass<AActor> before first use).

(“AActor” denotes “any class derived from AActor”. You can use your own subclass there if you want to filter things further.)

Is it only me or do Data tables not work correctly with asset an class values? I mean I have this structure:

And the data table row editor doesn’t show an option for the assets:

Hi ,

I’m having a hard time getting data tables to work in my project. Actually it works sometimes, but not everytime.
I created a struct in C++ to hold the data and the excel (from which I save the csv) using the template from the unreal web page.

My csv looks like this:

[]
,NeedName,Comment,Thumbnail
0,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_GoingHome_32.icon_GoingHome_32’”“”
1,TestNeed2,This is a test text,“”“Texture2D’/Game/Textures/icon_food_32.icon_food_32’”“”
2,TestNeed3,This is a test text,“”“Texture2d’/Game/Textures/icon_jewelery_32.icon_jewelery_32’”“”
3,TestNeed1,This is a test text,“”“Texture2d’/Game/Textures/icon_clothes_32.icon_clothes_32’”“”
4,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_books_32.icon_books_32’”“”
5,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_computer_32.icon_computer_32’”“”
6,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_furniture_32.icon_furniture_32’”“”
7,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_games_32.icon_games_32’”“”
8,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_groceries_32.icon_groceries_32’”“”
9,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_music_32.icon_music_32’”“”
10,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_perfume_32.icon_perfume_32’”“”
11,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_shoes_32.icon_shoes_32’”“”
12,TestNeed1,This is a test text,“”“Texture2D’/Game/Textures/icon_tools_32.icon_tools_32’”“”
[/]

Now when I import into unreal engine 's what I get:


The entries crudly circled yellow are the only ones that will work / get displayed in my game.
What could cause that? btw. the csv. is UTF-8 encoded as I am living in a country with funny letters.

Edit: Now 's the funny part. When I copy the reference to the picture from the editor and paste it into the csv, it will work again. Even there is no apparent change in the csv itself.
Edit2: Ok, now 's the REALLY funny part. I don’t even need to paste into the csv. As soon as i click “Copy Reference” in the unreal engine and reimport the very same asset (Asset->Reimport List), the editor will once again recognize the link to the picture and it is displayed in my game.

Any advice would be greatly appreciated!

Thanks for your help

Does UE4 support exporting of data to a specified csv file too?

I am getting the same problem as JazzMalar, in that everything will work fine the first time, but when the project is re-opened, all references to assets will return ‘None’. But if I select all of the assets and “Copy Reference” then the engine recognises the path to the assets.

Can anyone offer any advice on this?

[=JazzMalar;207831]
Hi ,

I’m having a hard time getting data tables to work in my project. Actually it works sometimes, but not everytime …

[/]

I’ll comment a bit on this although it might not answer everything, just a few thoughts.

You do have a lot of quotes around your paths in your CSV. One double at each end of your path should suffice. And for that matter, you should have none because your data doesn’t have any commas, colons, etc. So there’s no ambiguity for the parser. You need quotes only when your data as anything inside that string which can be falsely taken as a new field marker.

's a snapshot of my master table referencing other tables.



Map_05,5,Village détruit,VD1,DataTable'/Game/Data/Dialogs/DialogueVD1.DialogueVD1',DataTable'/Game/Data/PNJ/PNJVD1.PNJVD1',false
Map_06,6,Douane,Douane,DataTable'/Game/Data/Dialogs/DialogueDouane.DialogueDouane',DataTable'/Game/Data/PNJ/PNJDouane.PNJDouane',false

See, Even “Village détruit” has a space and the parser doesn’t care because there’s no ambiguity on what consists field separation in this file.

Also, what is the type into which that path is stored ? A UObject ? I use FString. Then in my constructor chain, I end up using a constructor helper within my construction chain like so:



ConstructorHelpers::FObjectFinder<UDataTable> DialogOb(*map->DialogueTableName);
ConstructorHelpers::FObjectFinder<UDataTable> PNJOb(*map->PNJTableName);

I remembered that the basic example you are referring to does make use of objects in the structure and I ran into similar problems. I then decided to use FString and it works well so far.

Cheers.

I still can’t figure out if it’s possible to use arrays within my data structures.

Also, can a TAssetPtr reference any type of asset? Say a particle effect for a spell?

[=DrHobo;210985]
I’ll comment a bit on this although it might not answer everything, just a few thoughts.

You do have a lot of quotes around your paths in your CSV. One double at each end of your path should suffice. And for that matter, you should have none because your data doesn’t have any commas, colons, etc. So there’s no ambiguity for the parser. You need quotes only when your data as anything inside that string which can be falsely taken as a new field marker.

[/]

Hi DrHobo, hi teeds
Thanks for your reply, as neither my AnswerHub Post nor my post didn’t seem to get any attention, I was starting to worry that I might be the only one with DataTable problems.

@DrHobo
Thanks for your insights. The double-quotes were my first thought as well and I tried to omit them completly. Unfortunately the only result from this was, that the engine could not even parse the path to the asset. When I import the datatable without the quotes, the datatable editor in the engine shows the path to my asset as


Texture2d'

. The rest of the colums are displayed correctly (as it was before).

Funnily enough, in my other datatable where I reference static meshes I don’t have this problem at all. It seems to happen only with Texture2d objects.
As soon as I’m home I’ll check my C++ struct to doublecheck the datatype of the tassetptr…

Thanks anyway and cheers

[=JazzMalar;211797]
Hi DrHobo, hi teeds
Thanks for your reply, as neither my AnswerHub Post nor my post didn’t seem to get any attention, I was starting to worry that I might be the only one with DataTable problems.

@DrHobo
Thanks for your insights. The double-quotes were my first thought as well and I tried to omit them completly. Unfortunately the only result from this was, that the engine could not even parse the path to the asset. When I import the datatable without the quotes, the datatable editor in the engine shows the path to my asset as


Texture2d'

. The rest of the colums are displayed correctly (as it was before).

Funnily enough, in my other datatable where I reference static meshes I don’t have this problem at all. It seems to happen only with Texture2d objects.
As soon as I’m home I’ll check my C++ struct to doublecheck the datatype of the tassetptr…

Thanks anyway and cheers
[/]

Hey JazzMalar, I am having the exact same issue, but I am trying to create a TAssetPtr. I need to have triple quotes, like


"""UParticleSystem'/Game/FX/Spells/Fireball/PS_FireballProjectile'"""

for it to show up as


UParticleSystem'/Game/FX/Spells/Fireball/PS_FireballProjectile 

, otherwise it just shows up as


UParticleSystem'

. Nothing I do seems to solve it, including the Copy Reference thing someone mentioned earlier.

Yeah, this is really annoying, and clearly a bug. I can’t even replicate a successful import when using the default Texture2d example from the first post.

When I try the triple quotes in my datatable, it crashes the editor instantly.