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
1
Question by Rodrigo Moraes · Nov 07, 2010 at 08:21 AM · scene-loadinglevel

Single scene, multiple levels

Hi,

I have many levels defined in yaml files. It is a simple board game so the level files define the format of the board, tile types and positions for the game elements. I made it this way so that it would be very easy to design new levels -- just save a new yaml file and voil.

Now to load a level, I need to add the same scene multiple times and load the level file based on the scene index (nothing really changes in the scene, the level data is all in the yaml file). This is a little inconvenient for two reasons: I have to manually add the same scenes to the game build and to track the correct indexes.

I wish I could avoid having to add the scene multiple times, but I'm afraid there is nothing I can do. Is there a different strategy for this?

I hope the question was clear. :)

Comment
Add comment · Show 1
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 DannyB · Jun 19, 2012 at 05:20 PM 0
Share

How do you read YA$$anonymous$$L?

1 Reply

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

Answer by StephanK · Nov 07, 2010 at 01:50 PM

I guess you already have a function that initializes your game when you start a scene. Just modify this function so it takes the level index as parameter and then initialize using the specific data from you yaml files. All you have to do now is reset the game state when a level ends (removing objects, reset points etc.), then call you init function and you're done. No need for multiple scenes.

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 Rodrigo Moraes · Nov 08, 2010 at 06:01 PM 0
Share

Thanks for your answer. I'm a little confused with this. Yes, I have a script that loads a level following the definition in yaml. So I understand that I'll have to manage all the object destruction, as you say, and basically load a scene once and from that manage it all myself to change to different level.

avatar image Waz · Nov 24, 2010 at 11:25 PM 0
Share

And if you don't have an easy way to reset everything, just reload the level (Application.LoadLevel(0)), presumably after setting some object that knows about the next yaml file to be DontDestroyOnLoad.

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

1 Person is following this question.

avatar image

Related Questions

How do I stop the scene from switching when the gameObject is destroy / 0 Answers

Check if level has been loaded? 1 Answer

What to consider for changing environment, using enable/disabled or new scene? 2 Answers

help please: Level Changing Scipt 1 Answer

Loading Screen? 6 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