Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

How to get name of SpriteAtlas via code?

Discussion in '2D' started by HuldaGnodima, Apr 3, 2021.

  1. HuldaGnodima

    HuldaGnodima

    Joined:
    Oct 10, 2016
    Posts:
    57
    I tried getting the Atlas-name like this (because that's how I read it should be done online, for example here):

    mySprite.texture.name;

    However when I do this for some reason got a really long name (instead of the Atlas' name). My real atlas name is :

    "TileAtlas_MossBrick_Outline"

    But when I via a code and a sprite accessed its name I get:

    "sactx-0-1024x1024-DXT5-TileAtlas_MossBrick_Outline-07e24639"

    Does anyone know why this long name appears instead? And how I could fix it (so I only get the shorter resource name)?

    Thanks in advance!
     
    Last edited: Apr 3, 2021
unityunity