- Home /
Public file for configuration
I'd like to have a .xml file that can be configured during run-time to make changes in my application. Currently, I have not found a way in the build process to specify a file as being available for editing by a user.
As a little background, I'm currently creating a menu system for some slot games that is being ported over to Unity. Because of legal requirements and client specifications rapidly changing, I'd like to be able to edit this menu via a .xml file, so there wouldn't be a need to recompile the entire project, as the menu is generated at run-time. In most applications, this is just a matter of having an app.config file or something similar, but I haven't seen the equivalent for Unity. Any pointers?
Answer by Dave-Carlile · Jul 25, 2016 at 08:51 PM
You can use normal .NET code to open the file for reading, parse it (JSON is a good format, or xml), and create the menu based on the contents. The file itself would need to be somewhere besides the Assets folder - the project root is a decent place. You can use a post build function to copy the file to the build target folder using normal file IO operations.
Relevant documentation:
Your answer
