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 hollym16 · Aug 29, 2013 at 11:08 AM · androidscene-loadingreturnapplication.loadlevelslowing-down

Return to a scene rather than loading again

Hi,

I'm currently using Application.LoadLevel to navigate though scenes, however, returning to a scene reloads the level rather than just returning to it, this takes a huge toll on the memory and causes the android app to be slow and eventually crash.

Is there a way to not constantly load one scene on top of the other if its already been opened?

Comment
Add comment · Show 7
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 dorpeleg · Aug 29, 2013 at 11:18 AM 0
Share

dupe? link

avatar image hollym16 · Aug 29, 2013 at 11:24 AM 0
Share

I really need the help

avatar image Hoeloe · Aug 29, 2013 at 12:11 PM 0
Share

The purpose of scenes is to segment your game into pieces so that you don't have to have the entire thing in memory at once, right? You need to reload it because the application gets rid of it to make memory space for the new scene. I'm not sure how you can prevent it from doing this, but it's pretty much defeating the point of having them in separate scenes.

avatar image hollym16 · Aug 29, 2013 at 12:24 PM 0
Share

Then why is my app crashing when I go back to the main scene which loads fine when opening the app?? Unity does not drop all memory when changing scenes. As far as I've found out from searching, Unity is reloading ON TOP of what is already loaded. Otherwise there would be no crashing after a couple of scene changes, right? I am trying to find out how to free up memory with some sort of destroy object or memory dump. Either that or not reload into a devices RA$$anonymous$$.

avatar image fafase · Aug 29, 2013 at 01:08 PM 0
Share

The loading of a scene probably involves a GC.Collect(); command. Loading a scene whether it has been loaded before or not is a brand new one. Everything from the previous is gone and lost except if you use static or DontDestroyOnLoad. As for your issue, you need to provide some info as we can only assume without seeing your code. I would suspect the crashing to happen from the scene you are leaving not the one you are going. That is if you are not extensively using static and your first scene rely on one of them and it gets sets to 0 on first load and then gets assigned a new value later that is not appropriate anymore. Again I assume, I do not know.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Silverfell · Aug 29, 2013 at 04:44 PM

When loading a new scene, the current scene is unloaded. This can be as memory-intensive as loading. If GC gets involved, even more so.

There are some methods to help with this, such as Application.LoadLevelAdditive or its Async versions. This may be suitable to load your menu again, but probably won't work if you are running low on memory already.

Have you considered passing through a relatively empty loader scene? If switching between big levels is proving too heavy, you could pass through an empty scene, and then load a more intensive one - sounds like a proper loading manager is outside the scope of your project.

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

21 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

Related Questions

Android build slows time after a while 0 Answers

Menu on Android Application 1 Answer

Application.LoadLevel(Application.loadedLevel); wont work While checkpoints are on 3 Answers

Creating Multiple Similar Scenes Effectively 1 Answer

Scene Change OnCollision Not Working 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