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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Load progress indicator

Discussion in 'iOS and tvOS' started by gizzerd91, Nov 14, 2008.

  1. gizzerd91

    gizzerd91

    Joined:
    May 4, 2008
    Posts:
    311
    Once my main menu screen is loaded, the user presses the play button and it goes to load up the actual game level. This loading takes about 15 seconds, which ontop of the Made with Unity splash screen is long. Is there a way I can put in a "Loading Percentage: X" piece of text on the bottom, or ideally a bar? Is there a command that will return how much of the level is loaded on the iPhone? Or if that can't be done, can you do any processing (like a minigame) while something is loading? I read something about how you maybe can't, and wanted it clarified. Let me know what you think.
     
  2. Randy-Edmonds

    Randy-Edmonds

    Joined:
    Oct 10, 2005
    Posts:
    1,122
    I'm not sure. However in my game, Night Divine, I have a "loading" level that I tried to put some particle system on that users could watch while the next "real" game loaded.... but the particles didn't animate, it was like Unity was paused (bogged down) while it was busy loading the game data.
     
  3. Jayanta

    Jayanta

    Joined:
    Sep 20, 2011
    Posts:
    9
    How to get a Game Level Loading progress in unity3d ? Have you any idea ?
     
  4. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    You could use a native function (obj-c) to show up a bevel turning. Prime31's plugin allow this with one line of code and will show a view + a message while your level is loaded.
     
  5. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    I load in a transition scene that has a cool background with a spinning load wheel (like a lot of console games) that just rotates, it does not give a percentage, but it does show the player that the level is still loading and the game did not crash or something, then I load my next level with Application.LoadLevelAsync so the spinning wheel still runs.
     
  6. zyndro

    zyndro

    Joined:
    Oct 19, 2010
    Posts:
    78
    Thanks for the tip!!
     
  7. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,245
    I have tried this, but when the level loads for 5-10 seconds it is very bogged down. it doesn't happen with the normal level.

    Did you encounter this?
     
  8. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Is the Profiler available for you?
    Would be very interesting what the game is doing in that time.
     
  9. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,245
    Okay with the risk of sounding very dumb, what is the profiler?

    Basically it drops to 6-7 fps instead of the normal 60-70 fps.
     
    Last edited: Sep 27, 2011
  10. pat_sommer

    pat_sommer

    Joined:
    Jun 28, 2010
    Posts:
    586


    i guess a choppy spinny wheel is better then non at all huh ;P loll


    thanks for the tip crazy! im going to try to implement this in my game for sure!
     
  11. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,245
    Actually it isn't the "spinning wheel" part that is the problem. It is the level that is loaded.

    I can get the loading screen to work okay, but the actual level is totally lagged for 10-15 seconds which doesn't happen with the standard loadlevel.

    I don't know if i am just missing a step.
     
  12. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    that sounds like the "new textures are not loaded behind the loading screen to be rendered in front of the view, so they are in vram" optimization you are missing so it stutters every time a new texture not seen previously is seen by the cam
     
  13. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    I load in a blank scene to purge memory using the normal Application.LoadLevel, and then I load the transition scene with a script that randomly loads in a background (170 kb) texture from the resources folder also using the normal Application.LoadLevel. The spinning wheel is just a sprite that rotates using function Update. Then I load the main scene with Application.LoadLevelAsync. It works for me, but if someone can optimize it better, that would be great. I can attach my script later tonight.
     
    Last edited: Sep 27, 2011
  14. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,245
    How would i fix this? It is driving me mad and makes it unusable. I don't know how to change these settings. But it doesn't happen with the normal loadlevel, just loadlevelasync.
     
    Last edited: Sep 28, 2011
  15. rbisso

    rbisso

    Joined:
    Jul 13, 2011
    Posts:
    29
    Seriously... the whole engine stopping while LoadLevelAsync is loading my next level is driving me insane. Has anyone found a solid answer for this? It seems like all these discussions just fizzle out.

    Here are the specifics of my case:

    - Using Pro

    - Running on Android

    - Don't have anything heavy in any of the start/awake functions of the scene being loaded

    - The old scene (with a progress meter, reading off the progress of the async operation), as expected, is still loaded while the async operation is underway, The progress meter, however, practically stops at like three frames per minute.

    - I put a debug.log msg on Update(), just to see what was going on... it ran about seven times, sporadically, during the ~30 second load.

    - I tried, as suggested in another thread, using

    while(!asyncOpLvlLoad.isDone)
    {
    yield return 0;
    }

    as opposed to just yielding the async op. No luck.


    I'd really appreciate any help with this, what a pain in the butt.
     
  16. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,245
    i never found a solution and ended up just loading and in between loading level to solve the issue for me. Pretty bad solution but i couldn't spend the time to make it work (if even possible)
     
  17. probbins

    probbins

    Joined:
    Oct 19, 2010
    Posts:
    216
    I've been wanting a solution for this as well, found a alright solution but wish it was better.

    I have unity pro so I can use Application.LoadLevelAdditive and Application.LoadLevelAdditiveAsync, except AsyncOperation.progress is completely useless, essentially completed in 1-2 frames, then spends 5 seconds initialising the scene.

    My current solution is using a SceneLoader script, which is set to high priority in the in script execution order, it gets all the game objects deactivates them, then enables them.

    The SceneLoader script provides much more useful progress variable which is just loaded gameobjects / total game objects. It also sends a message to all the game objects at the end of loading with a OnSceneFinishedLoading which I use instead of awake and start. Any object I put the script SceneObject can have a priority too as it get handled in a determined order.

    I dont really like this method though as due to my current implementation, as I like to create generic reusable code and I cant do that so much as start and awake are not so usable in my current setup.

    Anyway I would love to hear if anyone has figured out a elegant solution to loading scenes with progress bars loading screen.

    EDIT: I should mention that my project is not iOS specific. I found this thread from a search and posted without realising it was in iOS section.
     
    Last edited: Mar 27, 2013
  18. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,237
    just use AsyncOperation.progress

    Multiply the progress value by 100 this is because AsyncOperation.progress gives you between 0 and 1 but rounds the value off for some reason, so it doesn't work. By multiplying by 100 it works. For my NGUI slider value it needs between 0 and 1, so i divided by 100.

    That's what I did for a game I'm working on, here's a video of it in action:

     
    Last edited: Mar 27, 2013
  19. probbins

    probbins

    Joined:
    Oct 19, 2010
    Posts:
    216
    Lots of people keep saying that as the solution to the million posts on this topic, but like a lot of other people as well, that just will not work for me :(

    The AsyncOperation is completed in a single frame, it then takes 4-6 seconds to initialise the scene.

    So again, still looking for a solution as AsyncOperation will not work!
     
  20. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,237
    Have you actually tried it on the device? It only works properly on the device
     
  21. probbins

    probbins

    Joined:
    Oct 19, 2010
    Posts:
    216
    Yeah I have, I should mention the platform I am focusing on is PC/Mac. I didn't realise at the time of post this was thread was in the iOS section. I found the thread via a search.

    Even though it look like there is no decent solution, thanks for your assistance.
     
  22. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,237
    Ah, well it works for iOS.
     
  23. RMGK

    RMGK

    Joined:
    Sep 30, 2011
    Posts:
    75
    Nay movement on this? I am using AsyncOperation.progress but looking for something thats not so choppy. I tried threading but rendering is blocked from non main threads. Tried to use the _time value in the shader but I think thats linked to the main thread anyway. Anybody try Co-routines yet?