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 Pondomaniac · Jun 02, 2014 at 04:44 PM · save scene

How to create a scene programaticly

Hello everyone, I want to create an editor extension that permit to create a scenes with a given name and duplicate them, is there any free method ( not using YAML format because it's for the pro version only ) thank you,

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by fafase · Jun 02, 2014 at 04:56 PM

YAML, XML, XAML, JSON or other are all the same thing, a text file just like a plain notepad file.

Only difference is that the extension is different so that it is recognized by software to contain special keyword or layout to speed up parsing.

Most engine or framework come up with their own extension and their own layout, for example Marmelade uses .mkb for prefab, but it is just a text file with special character to indicate beginning and end of file and so on.

Then you can come up with your own text file for your scene and your own method to read and parse your file. This below is a .fafase extension

 {
    scene : 01_
    scenename : FirstScene_
    object : 
        @ 
          name : Player_
          prefab : Player_
          position : 00.00,00.00,00.00_
          rotation : 00.00,00.00,00.00_
          scale : 00.00,00.00,00.00_
 }

Now you can come up with a parsing system that I will simplify greatly:

 void CreateFromFafaseFile(string fafaseFile){
     // Get scene number and scene name and compare to current scene
     while(@ is found)
        // start parsing info using _ as end of line
        // Get the prefab and fetch it with Resources.Load and put it in prefab
        // Get the name and store it in string name
        // Get the position , rotation and scale and store in V3
        // instantiate using parsed info
        GameObject obj = (GameObject)Instantiate(prefab, position, rotation);
        obj.transform.scale = scale;
        obj.name = name;
        //get to next @ character
 }
Comment
Add comment · Show 2 · 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 Pondomaniac · Jun 02, 2014 at 07:37 PM 0
Share

Thank you, Actually i want to create a real scene and save it in the project hierarchy with code, and also i want to copy and past scenes. Do you now any short cut

avatar image fafase · Jun 02, 2014 at 07:39 PM 0
Share

I don't quite get the point of using Unity then. The purpose of an engine is that it does all of this for you, efficiently and easily. In your case you seem to want to overpass that. I would recommend to use OpenGL or DirectX then where you can start with nothing (actually a lot but nothing as engine) and you can do whatever you want then.

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

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I save & load gameObjects? 1 Answer

Will Restoring my computer restore my scene? 0 Answers

Is there a way to save a scene without opening it ? 1 Answer

Coyote model missing in Locomotion System 2 Answers

Save and load 0 Answers


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