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
2
Question by Michniewicz · Apr 29, 2016 at 06:28 AM · issueloading screenmemory leak

Leaking GFX memory on iOS on LoadSceneAsync

I use following scenario to implement loading screen between scenes in one of my games:

  • I have a separate scene which displays loading animation and loads target scene asynchronously. Scene consists of animation GUI and SceneTransition class implementing target scene loading logic

  • Whenever I want to load new scene with loading screen, I call static method SceneTransition.GoToScene(string sceneName) Loading screen scene is loaded and async loading of target scene starts

  • When target scene loads, profiler reports increase in allocated GFX memory (this seem to depend on a scene complexity, in case of my game it's around 20 additional MB). This memory is never released which, in case of my game, leads to crash after switching scenes ~15 times.

I've managed to make a simplified example, which has a scene with RELOAD button and loading screen scene. Clicking on RELOAD button causes loading the same scene asynchronously while displaying loading screen. In this case there is consistent increase of about 1MB in GFX on iPhone 5 device.

This happens in iOS build, but not in editor. Is it a Unity bug, or am I making some mistake with loading script?

 using UnityEngine;
 using UnityEngine.SceneManagement;
 using System.Collections;
 using UnityEngine.UI;
 
 public class SceneTransition : MonoBehaviour {
 
     private static string sceneToLoad = "";
     public Text m_loadingText;
 
     void Start () {
         var loadingTask = SceneManager.LoadSceneAsync(sceneToLoad, LoadSceneMode.Single);
         StartCoroutine(LoadingAnimation(loadingTask));        
     }
 
     public static void GoToScene(string scene)
     {
         sceneToLoad = scene;
         SceneManager.LoadScene("LoadingScene", LoadSceneMode.Single);
     }
 
     IEnumerator LoadingAnimation(AsyncOperation loadingTask)
     {
         while (!loadingTask.isDone)
         {
             int progressPercent = (int)(loadingTask.progress * 100);
             m_loadingText.text = "Loading " + progressPercent.ToString() + "%";
             yield return null;
         }
     }
 }

alt text alt text

Link to project reproducing this issue: http://bit.ly/1SMFDBz

1.png (123.1 kB)
2.png (122.9 kB)
Comment
Add comment · Show 3
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 ellioman · Mar 12, 2017 at 10:30 PM 1
Share

Did you ever manage to find a solution to this? I seem to having the same issue in a game I'm working on.

avatar image IgorAherne · Mar 13, 2017 at 01:19 AM 0
Share

bumping out of interest

avatar image Mehrdad995 · May 03, 2020 at 12:34 PM 0
Share

maybe unloading assets manually from memory would fix it???
try after scene loaded :
Resources.UnloadUnusedAssets();

0 Replies

· Add your reply
  • Sort: 

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Issue with object not bouncing around screen correctly 1 Answer

Why on the mobile do the elements seem to have a very unstable position? 0 Answers

Is it possible to cache next level before loading it with LoadLevelAsync()? 1 Answer

Animated Loading Screen Unity Indie 0 Answers

WebGL Loading Bar 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