Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Attempting to reference a DataTable in c++

I am having trouble referencing an already imported DataTable from an .csv file. I created the struct inheriting from FTableRowBase, and imported just fine. My problem currently is referencing that Data table in other parts of the code. What is currently failing is the construction of the FObjectFinder. What is the correct way to go about referencing this data table?

Here is my attempt so far:

 UDataTable* ExcelTable;
 ConstructorHelpers::FObjectFinder<UDataTable> ExcelTable_BP(TEXT("DataTable'/Game/DataTables/ExcelExample.ExcelExample'"));
 ExcelTable = ExcelTable_BP.Object;
 FExcelData* RowLookUp = ExcelTable->FindRow<FDGExcellData>(TEXT("Enemy1"), TEXT("LookUp Operation"));

Product Version: Not Selected
more ▼

asked Jun 26 '14 at 01:35 PM in C++ Programming

avatar image

664 21 18 177

avatar image BaderThanBad Jun 26 '14 at 04:37 PM

I got a step further (didnt have the objectfinder function inside a constructor, woops) Now the FindRow isnt retrieving the row. I tried debugging it and the rowstruct inside the ExcelTable is not defined apparently.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Never mind I solved it. For anyone else who stumbles upon this make sure the call to objectfinder is in an objects constructor (i believe this step is done when the editor is starting up, so you link it correctly). Then make sure when you import/reimport that you compile and run the editor again, it seems that the reference becomes invalidated when you reimport the Data Table.

more ▼

answered Jun 26 '14 at 05:10 PM

avatar image

664 21 18 177

avatar image HollingsworthDan Apr 16 '15 at 10:36 PM

But then you have to reconstruct everything that uses the data any time you re-import. The constructor is probably not going to be the best place to put his code..

Instead, you can use:


To load it outside of the constructor.

Then you can bind to the FReimportManager::Instance()->OnPostReimport() delegate to dynamic reload the data, outside of the constructor, and refresh your in editor views whenever the table is reimported.

avatar image BaderThanBad Apr 17 '15 at 08:25 AM

If you for some reason want the values in editor views then what you describe is probably possible (this is a very old post). However, what I did works perfectly fine during runtime of the actual game. Im not sure that something with ConstructorHelpers can be placed anywhere but the constructor unlike what you are claiming, but then again the engine might have changed since then and I have not looked at that stuff recently while my code still works. People that need to have the values refresh in editor views should try your method.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question