Build settings: how to export files into the build

Hi, I’m building my game for PC platform. In my Assets folder I’ve put some files and folders, for example there’s an xml with some setting parameters of the game.

I get the files in my scripts using the Path (for example “Assets\Settings\settings.xml”)

The game is working great in the unity editor, but when I start the built .exe version, it shows me the error that it cannot find those files in the Assets folder.

So which is the best way in order to use some custom files that is available also in the Built version?

Thank you!! :smiley:

The assets that are used in the scenes that are included in the build settings are only exported during the building process. So custom files like XML or TXT are not included normally… Unless it is inside “Resources” Folder.

So Make a folder named Resources in side assets folder and place your xml inside that

And now loading the XML is a bit tricky,

    TextAsset temp = Resources.Load(XmlFileName) as TextAsset;    		
    XmlDocument _doc = new XmlDocument();
   _doc.LoadXml(temp.text);

instead of loading from stream or other you have to use TextAsset from unity to load xml here. except the loading part the method of handling would be the same …

Hope it helps :slight_smile: