Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by _AB · Jun 17, 2015 at 04:19 PM · c#editorprogrammingdllapi

Creating Scenes Programmatically From A Deployed Build in Unity

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.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Baste · Jun 17, 2015 at 04:34 PM 0
Share

To go from a scene file to a runtime scene, you kinda need the editor, as that bakes together all the parts of your project to playable things.

A scene in Unity contains a bunch of plain objects, and a bunch of prefabs. In addition, it contains a bunch of links to assets in your Assets folder.

When the levels are built (or you press play in the editor), all of that stuff is baked together to create an actual level. That process happens under the hood - you can hook into it, and I believe you can run it from the command line, but you need the editor for it to happen.

So making new, standalone builds won't work. What you can do is to make a program that parses the xml files to create levels (and level selection menus) by adding things to an empty scene with some hook scripts. Creating a new "game" would then mean bundling your prebuilt Unity executable together with those xml files.

You can probably write a program that turns that bundle into a standalone .exe, which will give the impression of doing exactly what you're asking for.

Or you could buy source access from Unity to be able to extract the building-part of the editor, but source access costs so much that it's not even listed.

avatar image _AB · Jun 18, 2015 at 01:57 AM 0
Share

@baste, thanks for the speedy reply. I guess Unity was made to be used as "Unity". I'll try my luck by creating a simple scene, parsing the X$$anonymous$$L file, and creating the game objects there.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Peter Suwara · Aug 04, 2015 at 05:56 AM

Try using the following during a Build Script call from the command line :

 EditorApplication.NewScene
 ... Do your thing with assets/prefabs.
 EditorApplication.SaveScene

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image _AB · Aug 04, 2015 at 07:29 AM 0
Share

That actually could work, but the problem is that I can't use anything related to Unity tools, even the command line.

I ended up creating a "base" game that loads up an X$$anonymous$$L file and generates the content accordingly. Thanks for the answer though.

avatar image Peter Suwara · Aug 04, 2015 at 07:32 AM 0
Share

That would definitely work. Essentially what you have done is built a tool created by unity, to create data that can then be parsed by another executable built with unity, which does the parsing and creation of objects in realtime. :)

Nice one !

avatar image _AB · Aug 04, 2015 at 07:34 AM 0
Share

Thanks man !!!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Programatically creating entire Unity games 2 Answers

Distribute terrain in zones 3 Answers

How to fix losing System.Data.dll in Project? 2 Answers

Initialising List array for use in a custom Editor 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges