Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is somewhat of an extension to this question: http://answers.unity3d.com/questions/513801/programatically-creating-entire-unity-games.html

I have a client who would like to create an entire game only using XML files. This is how the process should go like:

  • Build & Run a "GameCreator" project.
  • Read an XML file that has the attributes of all the scenes.
  • Create new scenes, fill it with new GameObjects, and load some prefabs.
  • Deploy this new project as a standalone build.

All of the above should NOT use Unity Editor. Is that possible ??

What happened is that I used Unity to create a "Framework", and the client wants to use this framework to generate more games without using Unity Editor, only through XML files.

I know that one can read XML files with Unity, but how to create a scene, fill it with GameObjects, load prefabs all using a standalone build, not the editor ?? Is there any other way to do what I've described ??

Thanks.

share|improve this question
1  
I don't believe you can build scenes without the editor( either in a game build or asset bundle build ), but why not just build a single scene and manage what a scene is yourself? If you're not using the editor, what do you gain by using Unity's scenes? – Ben Jun 17 '15 at 9:37
1  
You are doing it wrong. This is adding a ton of complexity, for seemingly no reason. That being said, you could generate your scenes via XML files, just as long as you have all your prefabs already created. – Jon Jun 17 '15 at 11:17
    
@Jon I guess you're right. I'll create a simple scene with my prefabs, and then just parse the XML file to create the gameobjects and other links. – DBoxer Jun 18 '15 at 1:56
    
It sounds like your client may be treading close to legal concerns. I'd be careful you don't violate any of the EULA with Unity. Some of what it sounds like may fall within the realm of repackaging and redistributing their engine, as it pretty much sounds like they want you to re-skin Unity so they don't have to pay a licensing fee for their particular application. C.Y.A. man – Stephan Jun 25 '15 at 18:19
    
What you're trying to do is creating an exe that emulates/simulates Unity Editor. Bad idea. Probably not possible to create scenes like that. – lvictorino May 21 at 9:24

You can do something like this. It looks monumentally stupid (Unity has an awesome editor, why not use it?), but just in case you do have a good reason:

  1. You can't create scenes programmatically, but you can have an empty scene and add whatever you need programmatically.
  2. Using prefabs is probably not the best idea: prefabs are usually loaded only when referenced in the scene. You can build a big list of all required prefabs in your game, and reference it, but then they all will be in memory - even the ones you don't need.
  3. Better use Asset Bundles - pack all your assets into bundles. Your bundle-building script can also save whatever metadata you need - so you'd have a list of all bundles, with IDs or names or whatever. Then when creating a scene from XML, you can load required bundles and instantiate the objects. Note that you'd probably have to "patch" the references by hand - e.g. if a model bundle needs a texture from another bundle, Unity may not find the texture automatically.
  4. The Asset Bundles would still have to be built using Unity Editor. If what you want is loading raw assets (e.g. .fbx or .png files) you'd have to write your own parser to load them, or look at Asset Store - there are loaders for some more popular formats there. However, at this point, you should actually stop using Unity as it's causing more trouble than it's saving.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.