# How hard is it to edit an xml based database in a Unity3D game?

I want to make an item database in xml for my game.

I was thinking about encrypting it, but I don't know how hard is it to edit the database.

I want my database to be moddable, but hard to screw up for average users.

(~I don't want kids to make the game unplayable, then unable to fix it)

Should I encrypt the database? Or will it just annoy the "modders", while the average players wouldn't find the database even when it isn't encrypted?

TL;DR How hard is it to get a raw xml file from a standalone build?

## 1 Answer

I want to make an item database in xml for my game.

Good idea.

I was thinking about encrypting it, but I don't know how hard is it to edit the database.

Encryption is an advanced topic. And it can be really easy to screw things up.

I want my database to be moddable, but hard to screw up for average users.

Moddable = Editable = Not secure. You choose.

(~I don't want kids to make the game unplayable, then unable to fix it)

Instead of preventing the edit, offer an option in-game to fix the xml file (Rebuild, load from backup, etc.). This would be easier for you and modders. And players can safely mess around without fearing to break the game.

Should I encrypt the database? Or will it just annoy the "modders", while the average players wouldn't find the database even when it isn't encrypted?

It will just annoy the modders. Most of your players won't even open the folder the xml file is stored.

TL;DR How hard is it to get a raw xml file from a standalone build?

It is not hard, but it takes some time to implement and polish the code. Take a look at this unify wiki article about serializing to XML file and deserializing back.

• Thanks for the fast reply! :) 1 last question: If there is a test.xml file in the Assets folder, how can I find it in a Windows standalone build? Aug 27, 2016 at 22:27
• @Tudvari Here is a tutorial video about that: unity3d.com/learn/tutorials/topics/scripting/… Aug 27, 2016 at 22:28
• From my tests it looks like the xml plaintext gets included in one of the .assets files Unity assembles in the _Data folder next to your game executable. You wouldn't want players to edit this file directly, but you can use the methods @S.TarıkÇetin linked to clone the contents of this asset into its own file in Application.persistentDataPath on startup if it doesn't already exist, or load data from the existing file if it does. This helps offer the backup feature described - if a player messes up the file, they can delete it & it will be regenerated with default values on the next run. Aug 28, 2016 at 0:17
• Thanks, and how can I open those .assets files? Aug 28, 2016 at 7:25