Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    316
    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