Page 1 of 1

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

Posted: Fri Nov 20, 2020 2:38 am
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 187 times
Specify CSV
Specify CSV
DS_CSVimport2.PNG (18.71 KiB) Viewed 187 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 187 times

Could you please help me with the commands to use to have the same effect as using the import tool?

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

Posted: Fri Nov 20, 2020 7:58 am
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.

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

Posted: Fri Nov 20, 2020 10:56 am
by ThierryS
Thank you Tony for your quick answer! I will use the code from the CSVConverter.cs file :D