external config files

In the old days games used (still?) ini files, but that format is quite limited.

I’ve thought about using XML, but being accustomed to E4X in AS3 all implementations in C# I’ve seen are quite clumsy… I’ve read about using a WSDL to be able to convert an XML directly into a class with objects/properties. Is this possible in Unity?

I’ve seen SimpleJSON but I think it’s a pain to edit JSON files as they grow big.

How do you guys do it?
What do you think it’s the best way of having human editable config files with unity?

What about ScriptableObject or local Sqlite db files, or .txt ?

ScriptableObject gets compiled with the app. I want to be able to modify the config file after the game has been compiled. If it was Ok for the data to be compiled with the app I could simply use any class with some constants, arrays and whatnot.

Using SQLlite (or any other DDBB solution) would mean a non programmer human cannot easily manage the data like in XML files.

As for txt files, I don’t see how that is better than using structured data like XML files…

I was hoping there was already some solution in Unity to serialise string data to objects.

Google. I’ve seen some stuff for serialization in Unity although I think it was doing it the other way around (EDIT: Actually it must work both way.s What would be the point of saving to file if you then couldn’t load it back to app). I think it’s on Asset Store. If not then there must be ready to use solution for what you need for C# on the web. Just bring that into Unity project.

EDIT: Personally I use txt in my framework but it’s in very early development so I didn’t have any need for bad ass config.so far

A WSDL describes a web service and the objects that back it. You don’t need this at all. If you decorate your serializable classes with the attributes out of System.Xml.Serialization then it will do the heavy lifting for you.

Given your requirements I would absolutely go the XML route.

http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer(v=vs.90).aspx

I just found out about Xpath which makes parsing XML files quite easy. Not as straightforward as E4X but it works and has great filtering capacities.

In case anyone is interested here’s an example: .net - c# reading xml file - Stack Overflow

And here is a simple Xpath tutorial: http://www.w3schools.com/xpath/xpath_syntax.asp

More general: Serialization (C# and Visual Basic) | Microsoft Learn (first hit on google)

Thanks for the link, I’ll take a look at deserializing XML files.

In case anyone is interested. Here’s how to deserialize an XML document into classes with properties.

http://stackoverflow.com/questions/364253/how-to-deserialize-xml-document