- Home /
How to load non-asset resources at runtime
I'm trying to create a tile-based game in which a map (2d array of tiles, serialized in an xml) will be randomly chosen from a list of possible maps, loaded, de-serialized, and then the map is created by a script.
However, I would like for these maps to be outside of the shared assets, so that anyone may drop their own xml into the "maps" folder, and it would be available for unity to load.
From what I've been able to gather, the WWW class seems to be more of an online thing, putting the xml files in the Unity Editor groups them as shared assets, and you can load from the resources folder, but unity groups them all as a "resource" file?
Essentially, I want to load files such as a single, bare xml from a "maps" folder.
Thanks!
The what (and if) of the solution will depend on the target platform. $$anonymous$$any platforms are sandboxed in a variety of ways that limit or prevent file I/O. For a PC build, you can use .NET file I/O and load files from whatever you want.
This will mainly be a windows standalone, but will include mac if possible. No mobile platforms or consoles. So, .NET will work? How would I access that, through System?
Also, in using the .NET I/O, could I create my own data file (like xml) to store data and write my own parser for it?
Try putting your xml files into a folder called Strea$$anonymous$$gAssets
http://docs.unity3d.com/$$anonymous$$anual/Strea$$anonymous$$gAssets.html