Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 sora_jp · Mar 03, 2017 at 09:13 AM · c#unity 5sceneslevels

Should i invest in level prefabs instead of scenes?

Hi all! I have a quick question for you. My game currently has 14 scenes, 1 menu scene and 13 levels. My goal is to have 120 - 220 levels.

Should i make every level a prefab or should i keep them as scenes? What is the performance impact of having many scenes? Will many scenes increase build time or startup time?

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

3 Replies

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

Answer by UnityCoach · Mar 03, 2017 at 09:20 AM

You can think of Prefabs as Serialized (Saved to Disk) GameObjects. All the Prefab mechanics available in the Editor (Apply/Revert) is no longer available at runtime. At runtime, it simply means that your objects are saved as data stored in the project instead of saved in the scene.

Although, unless you handle some scripts with very big data, what really weights are the resources (Assets) such as textures and meshes. And those will only be stored once anyway.

So, I would say you don't want to make an individual Prefab for every scene. But you do want to make prefabs for objects or groups of objects that you use often in different levels.

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 sora_jp · Mar 03, 2017 at 10:49 AM 0
Share

This is exactly the information I was looking for, thank you!

avatar image
1

Answer by Tortuap · Mar 31, 2020 at 09:32 AM

Be aware that any prefab that is referenced in your scene ( through -for example- a level manager that references all existing levels in an array, being a scriptable object or a game object or whatever, as long as it is referenced in your scene ) WILL BE LOADED IN MEMORY, as well as ALL THE PREFABS it references and ALL THE RESOURCES that are referenced by those prefabs (recursively).

This behaviour ensure that everything a prefab is made of is immediately available at runtime, for instantiating objects from it as fast as possible.

The drawback of course is that when having such organization of levels as prefabs, directly or indirectly referenced by the scene ( ex scene -> level manager game object -> scriptable object level list -> prefabs ), your memory is filled with all your levels and all the resources needed by those levels, while you only need one level and its resources at the same time.

You should rather use Resource loading instead, or scenes loading.

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

Answer by tanoshimi · Mar 03, 2017 at 09:49 AM

If you have that many levels, it sounds like you're creating a puzzle-type game, in which case you might want to consider placing the level objects programmatically through a script rather than saving them as separate scenes. There are many games that have only a single scene, and titles, credits, options menus, and the main game screen are simply (de)activated in that single scene as necessary. Remember that you can have multiple cameras if necessary!

Otherwise, the choice of prefab/scene is somewhat personal preference - now that async scene loading is available in Unity Personal, I'm tending to store all my level data in separate scenes because you typically get a smoother experience than instantiating a prefab.

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 sora_jp · Mar 03, 2017 at 10:48 AM 0
Share

Thank you for your answer sir!

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

8 People are following this question.

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

Related Questions

Online levels database 0 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Why does my Lerp only run once? 0 Answers

Enemy Ai is not working as planned 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