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
1
Question by FrancescoDiTommasoSWCG · Apr 04, 2018 at 02:05 PM · scene-loadingscene-switchingscenesscene-change

Scene loading problem

Hi, I'm creating a mobile game. I've currently three scenes:

  1. Main menu

  2. Level 1

  3. Level 2

And a script which load a level when the player press a button. When I load the scene for the first time everything is ok BUT, if I came back to the main menu and select another level, the main character and the enemies doesn't move until I use the pause button and the resume button.

This strange problem does not appear if I reload the current scene. It appears only if I make the following actions sequence

Main menu -> level (1 or 2) Level -> main menu Main menu -> level (doesn't matter which one of the two)

To load the scene I use SceneManager.LoadScene()

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

5 Replies

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

Answer by FrancescoDiTommasoSWCG · Apr 04, 2018 at 03:32 PM

Solved. The problem was that when I pause the game I set the time to 0. Then, if I come back to menu the time is still 0. It changes if iI press again pause and then resume which put the time to 1.

Comment
Add comment · Show 2 · 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 RageEye · May 05, 2020 at 05:43 PM 0
Share

Thanks guy, I had the same problem and wondered where it comes from XD

avatar image cdwanze · Jun 04, 2021 at 01:08 PM 0
Share

Thanks, The same mistake.

avatar image
0

Answer by davidcox70 · Apr 04, 2018 at 02:41 PM

Have you used "DontDestroyOnLoad" anywhere? Loadscene should reset everything to how you have the scenes in the editor. But "DontDestroyOnLoad" can be used to maintain data across scene loading. Maybe you have some parameters in there that need to be reset by script as you change scenes?

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 tormentoarmagedoom · Apr 04, 2018 at 02:44 PM

The problem then is not the loading scene itself. When a scene is load, Unity destroys all the object of the scene, then instantiate al objects of the new scene (exept for that objects with "DontDestroyOnLoad" property).

Are you using the DontDestroyOnLoad somewhere?.

When you say press de paise button you mean the Unity pause button at the top of the script? You should debug ypur code and see whats the satate of all scripts and variables.

Post what you find

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 FlaSh-G · Apr 04, 2018 at 02:22 PM

This is a problem with the implementation of your pause button - not with the scene loading itself. Mind posting the pause button's pausing code?

Comment
Add comment · Show 2 · 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 FrancescoDiTommasoSWCG · Apr 04, 2018 at 02:42 PM 0
Share

Ok I got the problem. Thank you, your comment helped me ;)

avatar image tormentoarmagedoom FrancescoDiTommasoSWCG · Apr 04, 2018 at 02:47 PM 0
Share

I convert the comment into answer. Please accet it as correct for future users.

Thanks! :D

avatar image
0

Answer by Dracmarz · Mar 25, 2021 at 12:25 PM

I just wanted to give my experience with this as well in case others stumble upon this thread (This is a highly suggested thread on Google based on the search criteria).

In my case when I was returning to the "Menu" scene from "Level1" I found two entries for the Menu scene in the "Hierarchy" window. One Menu scene is loaded and active, and there is a second one stuck on status "is loading". When trying to open more scenes they will end up having stats "is loading" as well.

I fixed it by finding the duplicate "Menu Scene Loader" in the Level scene and removing it.

Hopefully this helps someone.

Menu twice in Hierarchy


2021-03-25-22-21-46-window.png (8.1 kB)
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 michael07532 · Apr 27, 2021 at 11:31 AM 0
Share

Omg I have the exact same problem as you but can’t for the life of me understand what’s making this happen as my game over scene is a scene and is only referenced when players health is on zero....

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

87 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

Related Questions

Attempting to Create an Essential SceneElements Checker 0 Answers

UnloadSceneAsync() does not seem to work with additive scenes. 1 Answer

How can I make a loading screen with LoadSceneAsync 2 Answers

Old scene still appears for short time when switching scene 0 Answers

Multiple scenes loads to multiple clients and server can have a parallel view of each client scene ? 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