Page 1 of 1

Saving database externally

Posted: Wed Nov 23, 2016 5:55 am
by irve
As you may remember we wanted to change the database at runtime and got the excellent importing function.

Now the database has grown considerably and the time to import the Articy XML is becoming an issue for writers on their laptops. It is a great benefit for them to change things without running Unity and messing with the source control so I'd like to keep the feature.

While I can disable the importing for the testers who have older .xml files than in project, I would like to cache the resulting database so that it will be read from the disk only once.

Do you have an idea if this can be done without an external program while running the build? So I import the xml, get the db and then save the .asset to some player specific directory for future use?

Re: Saving database externally

Posted: Wed Nov 23, 2016 10:19 am
by irve
My googling around suggests that building a .asset file from within the player is probably not possible.

My reasonable alternative is to build a mini project which runs on a new .xml file and provides an asset bundle which could be then loaded at runtime.

Re: Saving database externally

Posted: Wed Nov 23, 2016 10:27 am
by Tony Li
[Edit: Looks like we were thinking along the same lines! :) ]

Hi,

There's no easy way to save an .asset file at runtime.

My first thought was to export to Chat Mapper XML format. But, while the import method is available at runtime, the export method is currently in the editor assembly, so it's only available in the editor.

What if you run Unity in batch mode? You could set up a command line that runs Unity in the background, converts an articy:draft XML file into a dialogue database .asset, and then saves that as an asset bundle? The asset bundle would then be your cached version that you could load whenever you want at runtime.