Hi! I’ve been working on a card game, and have a deck object which contains an array of “Card” structures. These are imported from a Datatable, and this seems to be working fine (see screenshots below). My issue comes when I try to add each imported Card struct to my deck array - the added item is often empty, and when it does contain attributes, often contains one or two of the three struct attributes. Any ideas as to what’s causing this/how I can fix it?
Could you show the loop / algorytm that picks the cards? Essentially, what’s on the left hand side of this.
It’s just a Datatable variable with a foreach iteration through the row names. Nothing fancy, just data import.
Little can be deducted from what’s shown, hence the question. So unless you’re on an ancient version of the engine, what we can see, should work as is.
Sure! Here’s the stuff used to import the datatable. Thanks for taking the time to look this over, it’s really stumped me.
Try connecting print string from row not found and see if it prints string on screen.
Or you could have initialized first two Deck arrays.
Also,what is in imported card file?
importedCardFile is a Datatable. I’ll try the print once I get back to my project.
Also, the print doesn’t fire at any point; it always finds a row. From the looks of the watched variables (see first post) it seems that every time that row is successfully cast into a card object with all variables intact, too. This is what’s really puzzling me, as it seems as though it’s the add node that’s breaking the objects.
Check the importedCardFile and how you are creating it.
I’m importing a .csv, and using it in the blueprint as an object reference to the asset. When inspecting the datatable itself, each row seems to be a valid card object, as I can select each row in the drop-down menu and see a card object with three variables below. I’m going to try temporarily replacing the datatable with a card array, and manually add the card entries for now, to see if that does anything.
Apart from *watching *the variable, are you testing this in any other way? The variable preview is not without faults and will show false-positivies, depending on the circumstances.
And where can we see that casting? Here you’re just adding structs to an array. Print the content of the array once you’ve populated it. In the script that you’ve shown so far, there’s nothing that *could */ *should *fail.
Either the issue stems from misinterpreting the watched list (read, it shows gibberish garbage) or there’s something else at play.
Hi! Looks like it was a “watch variable” issue - the array was being correctly filled, and the error causing all the error messages was elsewhere in the code. Thanks for all the advice though, it’s really helped!