![]() ![]() Get the provided atlas from the loaded sprites SpriteDic.Add(allSprites.name, allSprites) If (allSprites = null || allSprites.Length <= 0)ĭebug.LogError("The Provided Base-Atlas Sprite `" + spriteBaseName + "` does not exist!") įor (int i = 0 i < allSprites.Length i++) Sprite allSprites = Resources.LoadAll(spriteBaseName) Public void loadSprite(string spriteBaseName) Public AtlasLoader(string spriteBaseName) Creates new Instance and Loads the provided sprites Creates new Instance only, Manually call the loadSprite function later on ![]() Public Dictionary spriteDic = new Dictionary() You can load all the sprites from the Atlas with Resources.LoadAll then store them in a dictionary.A simple function can then be used to access each sprite with the provided name.Ī simple Atlas Loader script: public class AtlasLoader You can make your own API to get single sprite from Atlas located in the Resources folder like the image included in your question. There is no native API to get single sprite from the SpriteRenderer and no API to access individual Sprite by name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |