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 KarnEdge · Nov 30, 2013 at 05:21 AM · fpsmemoryframeratedontdestroyonloadcpu

What's better? Managers using DontDestroyOnLoad or keep one in each scene?

When it comes to making your game use less memory, reducing overall load times and keeping framerate up, do you have your Managers (Camera, Input, etc) use DontDestroyOnLoad and follow the player throughout the game OR do you put them in a prefab and toss it into every scene you make?

I ask because I realized some of my managers don't need to follow the player (no global variables, stats, etc), but need to be in every scene. I imagine that just making them DontDestroyOnLoad will reduce load time because you're loading them at the start of the game and never again, but maybe there is something behind DontDestroyOnLoad that makes it use more memory in the long run.

Anyone have an idea on this?

Keep in mind, I know I will still have to have a StateManager of some sort that will have to use DontDestroyOnLoad so I can keep track of stats, variables, etc.

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
2
Best Answer

Answer by Julien-Lynge · Nov 30, 2013 at 08:07 AM

@KarnEdge,

It's definitely good to be thinking about performance, but for what you're describing the difference is so negligible - a few ticks of time, probably only a few kB or MB of memory - that it really doesn't matter. It's much more important to go with whatever is going to make your job easier designing your game. If you have information that you need to keep between scenes, you could either use DontDestroyOnLoad or you could, for example, store the information in static variables so that any manager that's instantiated has access to them.

Personally, I like the second option, because it means that during development I can go directly into any scene without having to go through the main scene and instantiate my DontDestroyOnLoad object first.

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 KarnEdge · Nov 30, 2013 at 04:09 PM 0
Share

Thanks again @Julien.Lynge. I didn't see much on whether or not it mattered so thought I'd ask and put it out there.

Looks like I'll stick with the persistent managers and just have them load once on game start.

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

18 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

Related Questions

Is there a way to create applications that run on fixed frame rate of 60fps on iOS? 1 Answer

Low FPS rate. Can't find the problem. Followed Unity's Guide 2 Answers

Can I change the cap of framerate at web player? 1 Answer

Locking the frame rate 0 Answers

GPU usage and FPS have suddenly dropped significantly for my project and several others that I've tested 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