Unity game engine support xml files natively, but not ini. Ini are simple structure files, which are ideal for storing small pieces of information, like game settings, high scores, save data etc...
Therefore, I write a library to handle .ini files for Unity, and I put it here for you to use in your games.
Library features• Read, insert, modify, delete section and key value
• Support cross-platform (using culture-neutral settings and having no .dll dependency)
• Support string, bool, int, long, double, byte[], DateTime
• Support ini_file with comments
• Cache Ini_file content by Dictionary to boost performance
• Thread-safe access to file with Lock.
MethodsOpen(string path)
Open(TextAsset asset)
OpenFromString(string str)
string ToString(string str)
Close()
string ReadValue(string section, string key, string default) (+6 overload)
WriteValue(string section, string key, string value) (+6 overload)
SectionDelete(string section)
bool IsSectionExists(string section)
KeyDelete(string section, string key)
bool IsKeyExists(string section, string key)
NotesThe file can be in any extension (e.g. txt) as long as the content follows .ini format.
Open(TextAsset asset) will enable easy cross-platform ini handle, which sandbox the ini file.
CreditsThis library is adapted from STA INIFile and modeled after Game Maker Studio INI file system.
Get the library…Read more information at
http://www.glintycreative.com/blog/?p=133Download the library at
https://www.dropbox.com/s/hncicx2gz4zo2f0/Advanced%20INI%20Parser%20for%20Unity.zip?dl=0P.S. Although I have tested this library thoroughly and used it in my games, there might be some bugs. If you find some bugs, please reply to this thread so that I can fix the library.