Search Unity

  1. Unity 2018.3 is now released.
    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. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    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:
    42
    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:
    42
    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:
    330
    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