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 /
This question was closed Feb 06, 2018 at 05:06 PM by meat5000 for the following reason:

Too subjective and argumentative

avatar image
0
Question by GUZ666 · Feb 06, 2018 at 03:57 PM · bestpracticesgamestate

What is the best way to deal with game state and changing levels?

I am a professional programmer but new to game development and Unity. I am working on a simple arcade game where currently I have a single scene which will be used for all my game levels (levels differs only on how/what enemies are spawned). Currently I only have the 1st level and I need to decide how to deal with level changes, game state and main menu. Therefore I have a couple of question:

  1. When changing level should I use SceneManager to reload the scene or write some custom script to remove all spawned game objects and reset level?

  2. How to deal with game state? I have seen a couple of approaches: normal c# singletone (https://www.packtpub.com/books/content/creating-simple-gamemanager-using-unity3d), unity specific singleton (http://clearcutgames.net/home/?p=437), preload scene (https://stackoverflow.com/questions/35890932/unity-game-manager-script-works-only-one-time/35891919#35891919) but I don't know which is considered as best practice.

  3. Should main menu be a separate scene or it's better to build GUI on the top of my single scene?

  4. When having multiple scenes and singletons using DontDestroyOnLoad how to deal with testing individual scenes? Each scene should have the objects added or there is some way to load them form the first scene even if I want to check some other?

Thank you in advance.

Best regards Lukasz, I am a professional programmer but new to game development and Unity. I am working on a simple arcade game where currently I have a single scene which will be used for all my game levels (levels differs only on how/what enemies are spawned). Currently I only have the 1st level and I need to decide how to deal with level changes, game state and main menu. Therefore I have a couple of question:

  1. When changing level should I use SceneManager to reload the scene or write some custom script to remove all spawned game objects and reset level?

  2. How to deal with game state? I have seen a couple of approaches: normal c# singletone (https://www.packtpub.com/books/content/creating-simple-gamemanager-using-unity3d), unity specific singleton (http://clearcutgames.net/home/?p=437), preload scene (https://stackoverflow.com/questions/35890932/unity-game-manager-script-works-only-one-time/35891919#35891919) but I don't know which is considered as best practice.

  3. Should main menu be a separate scene or it's better to build GUI on the top of my single scene?

  4. When having multiple scenes and singletons using DontDestroyOnLoad how to deal with testing individual scenes? Each scene should have the objects added or there is some way to load them form the first scene even if I want to check some other?

Thank you in advance.

Best regards Lukasz

Comment
Add comment · Show 2
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 meat5000 ♦ · Feb 06, 2018 at 05:08 PM 0
Share

Hi Lukasz, sorry your question is regarded as "Off-topic, subjective or argumentative" due to its nature of requiring discussion. "Best practise" is a grey area, but the best way to learn how the devs think it should be done is to breeze through the tutorial content. It should be quick as a programmer. Dont let this put you off posting. But in future, ask 1 question at a time and try to be a bit more specific.

avatar image meat5000 ♦ · Feb 06, 2018 at 06:06 PM 0
Share

Also, discussions can be posted on the Forums, nearly forgot to mention.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

75 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 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 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

Best practice for object communication 3 Answers

Which to use Arrays, Collections, Lists and Generics 0 Answers

Best Practices for exception handling Resource.Load 1 Answer

Propogate upgrade to different entities (Wepon upgrade System) 1 Answer

What is the best practice in handling scenes with 100+ rigidbodies and collisions on iOS? 1 Answer


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