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 supbruh · Aug 28, 2015 at 12:06 PM · performanceprefabs

How many prefabs too many?

Instead of making many scenes, or many levels in one scene; which i don't know how to make, I was thinking of making all the levels a prefab. I am making a 2d mobile game btw. So, if there are 200 levels, would it be a problem if I made 200 prefabs? how would it affect the file of the apk? would it suck up too much power from the mobile phone? Please replay if you have an answer, that would be much appreciated.

Thanks in advance

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

2 Replies

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

Answer by Setsuki · Aug 28, 2015 at 12:12 PM

A prefab really depends on what it contains, I don't think you can have too many prefabs. However, for several reasons, I would highly recommend you to reconsider :

  • If your levels are prefabs, then you won't be able to use prefabs IN your levels.

  • Loading/unloading will probably cause performance issues, since Unity isn't really built like that.

Could you elaborate on why you can't use scenes, or multiple level per scene ? In our current project, we have 4 level per scene (a scene being a world), so I understand there are cases where you'd need a single scene for multiple levels.

Comment
Add comment · Show 7 · 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 supbruh · Aug 28, 2015 at 12:36 PM 0
Share

i am a novice coder btw. I am trying make a game similar to super meatboy. The camera follows the player, but after the level ends and i try to shift the "camera boundary" and camera to a new position where i have set a new level, the camera shifts back to its last position as oppose to the position i want it to be at, and the camera doesn't follow the player anymore. this is my problem with having multiple levels in one scene. Could you share your way of making multiple levels in one scene, that be really helpful.

Thanks

avatar image Setsuki · Aug 28, 2015 at 12:39 PM 0
Share

$$anonymous$$y camera is a child of my character. When the first level is over, the character is teleported to the next level. So the camera is teleported with it. But I still don't understand why you don't want to use multiple scenes.

avatar image supbruh · Aug 28, 2015 at 12:46 PM 0
Share

its just that with multiple scenes, i am going to have to tweak/ assign code individually. Just imagine, if i have 100 scenes. I am going to have to assign code hundred times to an object such as camera. And i read it somewhere that its really not that efficient.

avatar image Setsuki · Aug 28, 2015 at 12:52 PM 1
Share

I'd either :

  • Have a template scene where all that is missing is the level layout (The characters, the finish line, the camera, would be here) and duplicate that scene when I want to create a new level.

  • DontDestroyOnLoad my character. However, this could be painful to load a game.

Anyway, you CAN use prefabs for your levels, but make sure you manage memory well ; if you don't unload correctly what you don't need anymore, your game performance will be low. However, if you only unload what you don't need, and keep the common objects that are between two level, you'll probably have faster loading times than with scenes.

But realize that you'll need to write more code if you use prefabs than scenes.

avatar image supbruh · Aug 29, 2015 at 12:08 PM 0
Share

Thanks for the advice. I really appreciate it. Btw can you tell me what platform you are releasing you game on? is it mobile? if it is, can you tell me how you optimized your game for multiple screen resolution and aspect ratio?

Show more comments
avatar image
1

Answer by Vandie_Studios · Aug 28, 2015 at 12:23 PM

"which i don't know how to make" -OP

To make a new scene, first make sure you've saved your current one before going to file -> new scene. Then when building your game, make sure you add all the scenes in the wanted order in the scenes section of the build window.

Hope this helps, Signed, Vandie

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

performance benefits of using prefabs 1 Answer

Instantiating Prefabs Lags in Android 0 Answers

How to use many particle systems, just varying in size and emitter dimensions 0 Answers

Defender 2d Shooter - Loading Enemies (waves of enemies) 1 Answer

Instantiate prefabs to save memory 2 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