Search Unity

Loading multiple sprites from resources?

Discussion in 'Scripting' started by Marscaleb, Sep 26, 2019.

  1. Marscaleb

    Marscaleb

    Joined:
    Jan 7, 2014
    Posts:
    1,037
    I load several graphics for my HUD from the resources folder so I can change out various graphics when they are needed, with a simple:
    Code (CSharp):
    1. thisTexture = Resources.Load<Texture>("HUD/MySprite");
    But this requires to have each sprite/texture be one individual texture. If I try to have a sheet with several graphics on it and set the texture's sprite mode to multiple, I can't quite access any of these sprites from my script. I've tried every name and syntax that I can think of, but I can't get it to load.

    How do I load a sprite from a sheet of sprites with the sprite mode set to multiple?