Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Guppie1337 · Oct 28, 2015 at 07:25 PM · scene-loadingproceduralscene-switchinglevel loadcoordinate-system

Predfined Level Generation Procedural vs Scene

I am designing a puzzle game that has predefined levels and I can't determine what the best approach for level building is.

I am using a 2D coordinate system to place objects. Each object will start at a predefined position and be able to move around the board at the user's discretion. I have a build where I created each level individually and saved them as their own scene, I can then load them as needed through a level selection screen.. However, I find this to be flawed for 2 reasons:

1) I plan to expand this idea to allow a "Time Attack" mode where the user will be forced to complete an X number of levels under a time limit and require a seamless level load.

2) Build size is way larger.

This has lead me to still predefine my levels, but rather generate them procedurally. I do this by passing in the level number to a switch and loading each asset at the appropriate coordinates.

Is there a better way to do this? Pros/Cons of my current options?

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 Eno-Khaon · Oct 28, 2015 at 07:42 PM

First off, let's look at a few of your options of how to approach loading levels.

1) Multiple scenes, the way you're currently handling it: This allows you to have discrete, large-scale environments separated from each other with a relatively easy means of loading and unloading data between uses.

2) Prefabs: Rather than loading separate scenes, remove the existing "level" prefab and replace it with the next one. Unlike using multiple scenes, however, you will likely need to manually assign the "levels" to an array or List.

3) Procedural assembly: Less likely what you're looking for in this case, but still a potential option for level construction. While this can be implemented with difficulty level determined as part of the level generation algorithm, this would certainly be the most difficult to implement, but potentially the most expansive, as it could potentially provide an infinite number of levels.

Now, between these three concepts, I believe what you're looking for would be option 2.

You would probably be able to load up each scene, create an empty game object at Vector3.zero (or Vector2.zero for 2D?) and make your level a child of that. Then, that would be your prefab to create for each level.

Rather than loading a scene, Destroy() your current "level" prefab and replace it with the next one in line, based on an array of GameObjects (your level prefabs) rather than Applcation.LoadLevel().

Comment
Add comment · Show 1 · 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 Guppie1337 · Oct 28, 2015 at 11:34 PM 0
Share

Awesome answer. I don't know why I didn't think outside the box and realize you could fake a whole scene via prefab. Option 2 really allows for pretty much all the expansion/manipulation I plan to do in the future from mechanics to polish. Thanks, @$$anonymous$$o $$anonymous$$haon.

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

31 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Changing scenes while preserving background 1 Answer

AsyncOperation activating immediately even with async.allowSceneActivation = false; 0 Answers

UI canvas or panel that only appears once per game session? 1 Answer

Load scene in background and move into it without "loading" 1 Answer

Modify Scene origin before loading scene? Or LoadLevelAdditive @ certain world position 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