How to import CSV file without using import tool and anyway use Dialogue editor

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ThierryS
Posts: 5
Joined: Wed Nov 11, 2020 4:28 pm

How to import CSV file without using import tool and anyway use Dialogue editor

Post by ThierryS »

I want to import CSV file containing the DB with C# commands in script.
(the location and name of the CSV file, the name of the generated DB are fixed in the script)
Import CSV
Import CSV
DS_CSVimport1.PNG (46.32 KiB) Viewed 171 times
Specify CSV
Specify CSV
DS_CSVimport2.PNG (18.71 KiB) Viewed 171 times

How to have the same effect as using the import tool but using C# commands?
The idea is to import automatically the DB contained in the CSV file and after that watch the conversation flow using the Dialogue System Editor
Use Dialogue Editor (DB imported from CSV)
Use Dialogue Editor (DB imported from CSV)
DS_CSVimport3.PNG (56.79 KiB) Viewed 171 times

Could you please help me with the commands to use to have the same effect as using the import tool?
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to import CSV file without using import tool and anyway use Dialogue editor

Post by Tony Li »

Hi,

It sounds like you want to create the dialogue database from a CSV file at runtime. For general information about creating a database at runtime, please see: How To: Create Dialogue Database At Runtime.

In your own script, you can borrow the code that's in CSVConverter.cs to turn the CSV data into a database. That's one of the reasons why the Dialogue System comes with full source code, so you can see what it's doing and adopt the code for your own scripts, too.

The Dialogue Editor window only supports viewing dialogue database asset files. Generally speaking, you can't create asset files in your project at runtime. I'm working on a new version of the Dialogue Editor. It's a big task that won't be ready for a while, but I'll try to make sure it can also view runtime-created databases.
ThierryS
Posts: 5
Joined: Wed Nov 11, 2020 4:28 pm

Re: How to import CSV file without using import tool and anyway use Dialogue editor

Post by ThierryS »

Thank you Tony for your quick answer! I will use the code from the CSVConverter.cs file :D
Post Reply