- Home /
Creating a Level using XML
Hi All,
Is it all all possible, either using plugins or without, to generate a level on the fly using XML?
For example, if you have a pre-defined prefab, or game element, for example a cube, could you use an XML file to determine the postion of the item, and attach at premade script? For example, say you have a prefab called "building", and a script called "buildingController", and say that you wanted to put the prefab postion at 10, 10, 50 Could you use an XML file similar to the one below to do all this?
<xml>
<level>
<objects>
<item_1>
<prefab>
building
</prefab>
<script>
buildingController.js
</script>
<postion>
10, 10, 50
</postion>
</item>
</objects>
</level>
</xml>
Thanks!
There's a pretty good tutorial with almost exactly the same level structure at http://www.$$anonymous$$mbrookvale.com/tutorial-xml-level-unity
Answer by Eric5h5 · Apr 04, 2010 at 06:13 AM
Yes, you can do that, and you don't need plugins. You can use Resources.Load to import objects by name. You can parse the XML yourself or use System.Xml.
Your answer
Follow this Question
Related Questions
Can't use System.IO.FileInfo.Delete 1 Answer
A node in a childnode? 1 Answer
Best way to organize your levels (XML? ) 1 Answer
Creating 3D levels with text and XML files 2 Answers
Create level based on XML/TXT file 3 Answers