Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Preloading Options?

Discussion in 'iOS and tvOS' started by liquidgraph, Aug 8, 2010.

  1. liquidgraph

    liquidgraph

    Joined:
    Feb 26, 2009
    Posts:
    324
    I'm getting jerkiness when first starting a level. I'm pretty sure it's because iPhone his choking on the several 1024x1024 sprite atlases that I got. Bottom line: I need some preloading.

    I've read about using the preload hack where you basically show a loading screen while instantiating and destroying assets behind it. Seems very kludgy, and I'm afraid I will forget to preload some assets this way.

    Are there NO functions available to us to preload assets? What about Resources.Load? Would that help? What about jumping to (loading) the level from an empty scene? Does that load textures and such, or just gameobjects?

    If there's really no better way the instantiating behind a loading screen, is there some way to loop through all the objects, textures, meshes, and skinned meshes in the level and instantiate and then destroy them consistently? A code example would be much appreciated.

    Oh, and how do I determine how long to keep the loading screen up for? Is there a way to know when all assets are finished loading?

    It's hard to believe Unity doesn't have this much-needed feature. Any chance it's coming in the 3.0 release?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Nope, nope, and nope. The jerkiness comes from textures being uploaded to VRAM when first seen by a camera, which is something that happens at a system/OS level, so I'm not entirely sure how feasible it is to have any functions in Unity that would automate this. e.g., if you end up having more textures than can fit in VRAM at once, older ones are unloaded automatically, and have to be reloaded if those textures become visible again.

    One frame, if you instantiate/destroy all the objects at once.

    --Eric
     
  3. liquidgraph

    liquidgraph

    Joined:
    Feb 26, 2009
    Posts:
    324
    Stop making excuses! :wink: The fact that there's this preloading hack tells us that Unity could have a simple preload function, a la JavaScript or Flash.

    The 21st century has arrived and the people demand preloaded games!

    P.S. I don't nearly have enough textures to fill the VRAM. It's the same problem you get with DHTML when you don't preload your rollover images.