Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

insane android-only scene loading time problem

Discussion in 'Android' started by jecky111, Jun 23, 2017.

  1. jecky111

    jecky111

    Joined:
    Jun 11, 2016
    Posts:
    17
    Hi, I'm goint totally insane about one of my scenes in my game. :( I have 3 scenes: Menu, RpgScene and Battle. My problem is: when i load RpgScene from Menu, it is blazing fast, like 0,1 seconds on Windows and android platforms too. When i try to load it from Battle scene, it is absolutely fast in the editor and on Windows build too, but it takes random amount of time from android (usually from 10 seconds to 2minutes). The way i call the next scene is via a button, code is shown below. It looks to me (based on profiler and the manually created loading slider) that it absolutely does nothing for a random amount of time (cpu, memory kinda idles, slider is stuck at 0%) then it just loads it instantly. I tried to replace this problematic scene with an empty scene, same slow result. I got problem only if i try to load a scene from this scene. If i try the normal LoadScene instead of async version, it just freezes for a lot of time, then loads it.
    What exactly happens when i call scenemanager's loadscene? Is there any event that must finish before it actually starts loading? Its just a guess, i can't imagine anything else, i got stuck by this problem for 2 days :'(
    Unity version 5.6.1f1 / android target 4.4
    Any suggestions is really appreciated!

    public void battleWonButton()
    {
    StopAllCoroutines();
    StartCoroutine(AsynchronousLoad("RpgScene"));
    }

    IEnumerator AsynchronousLoad(string scene)
    {
    yield return null;
    loadingSlider.gameObject.SetActive(true);
    AsyncOperation ao = SceneManager.LoadSceneAsync(scene);
    ao.allowSceneActivation = false;
    while (!ao.isDone)
    {
    float progress = Mathf.Clamp01(ao.progress / 0.9f);
    loadingSlider.value = progress;
    if (ao.progress == 0.9f)
    {
    if (Input.anyKey)
    ao.allowSceneActivation = true;
    }
    yield return null;
    }
    }
     
  2. Qbit86

    Qbit86

    Joined:
    Sep 2, 2013
    Posts:
    487
  3. Egil-Sandfeld

    Egil-Sandfeld

    Joined:
    Oct 8, 2012
    Posts:
    72
    Last edited: Aug 3, 2017
  4. Donter

    Donter

    Joined:
    Jun 29, 2014
    Posts:
    1
    Hi, we are having exactly the same problem. Anybody found a solution?
     
  5. jecky111

    jecky111

    Joined:
    Jun 11, 2016
    Posts:
    17
    Cleaning out / not using the resources folder solved it for me! It seemed to me that I had too much stuff in there so the phone had memory problems due to it.
     
  6. Seraphic572

    Seraphic572

    Joined:
    Mar 11, 2016
    Posts:
    21
    "Not using Resources folder" didnt solve my issue ? Any other possibility Y this Occurs ?