Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  5. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

How do you use Resources.LoadAsync with a multiple frame sprite?

Discussion in '2D' started by aitchest-of-dees, Nov 3, 2016.

  1. aitchest-of-dees

    aitchest-of-dees

    Joined:
    Dec 28, 2013
    Posts:
    41
    I am trying to load all my sprites asynchronously and it works for single frame sprites, but if the sprite is setup to Sprite Mode: Multiple, only the first frame is loaded. All the answers I've found for loading multiple-frame sprites is to use Resources.LoadAll, which is what I was doing before. As there is no " Resources.LoadAllAsync" command, how do you load multiple frame sprites asynchronously?

    Code (CSharp):
    1.  resourceRequest = Resources.LoadAsync<Sprite>(loadPath);//path to multiple sprite mode sprite
    2. while (!resourceRequest.isDone)
    3. {
    4.      yield return 0;
    5. }
    6. sprite = (Sprite)resourceRequest.asset;//contains frame 0
     
  2. aitchest-of-dees

    aitchest-of-dees

    Joined:
    Dec 28, 2013
    Posts:
    41
    Well I've given up ,and separated all my sprite folders into single frame sprite folders and multi-frame sprite folders, and call a totally different method to load the multi-frame sprites the old way. This is very messy and annoying, since the idea of async loading is to spread out the slowest loading times during the logo screen so they don't make the game choppy or have a long load time between scene changes -- and multi-frame sprites are usually the largest sprite files to load. Unhappy, but moving on.
     
    IgorAherne likes this.
  3. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    244
    literally
    bumped into this issue 5 minutes ago.
    love how those things get on the way of programming and we waste several hours instead of advancing in our project