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 latbat58 · May 11, 2018 at 10:53 AM · scenesingletondesignmanagerreload

GameManager and scene design issue.

I am an extreme noob on both unity and programming in general so sorry about that.

In this first unity game thingy ive been working on, (2d endless runner) ive created an game object called GameManager with its script.(it is singleton and it doesn't get destroyed after scene reload cause it made sense to me idk). Since i wasn't planing to make this a huge game i thought this could handle generic stuff like displaying ui, stopping scene, reloading scene etc.

So I made a canvas for death screen which gets activated by this GameManager. But the issue is, in the next/reloaded Scene, GameManager tries to active the old canvas. (The deleted one from the old scene)

Should i turn canvas into a nondestroyable during scenes? What is a good design for a simple endless runner game? Is making GameManager nondestoryable during scene reloads is a bad idea? How would you design something like this? Any resource links about stuff like this?

I feel like i am doing something wrong by reloading the whole scene. Maybe i should make a separate level designer object and reset the level through that? As i said i just don't know. Simply learning the unity's editor/syntax is already too much for me lol :'S

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
0

Answer by TanselAltinel · May 11, 2018 at 11:12 AM

Hi latbat58,

We all started from some point, nobody was born with Unity knowledge :)

I personally think, for game managers and such, singleton might be a good choice. And I also think, if a game object is going to be used over all scenes, there is no need to destroy and re-instantiate it, since it will waste resources in vain, while you could use the already existing one.

However, you can also modify your script to get the new canvas in each scene load (SceneManager.sceneLoaded), so you will always have the current instance in your game manager.

However, good practice in Unity, is to re-use objects instead of destroying/instantiating them. So I think you are on the correct path.

Also, if it is a generic endless runner game, you can check some tutorials on YouTube, or even official tutorial: https://unity3d.com/learn/tutorials/topics/scripting/lets-make-game-infinite-runner

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

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

Creating a singleton game manager 1 Answer

How to set the position of an object in another scene? 1 Answer

Objects still in scene on loadscene? (creating objects on destroy?) 0 Answers

Reload scene when dead 5 Answers

Singletons in multiplayer games 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