본문 바로가기
Unity3D/Unity & C#

Atlas에 들어있는 Sprite Load

by 캬캬백곰 2022. 4. 22.
728x90

참조 https://docs.unity3d.com/ScriptReference/U2D.SpriteAtlas.html

using UnityEngine.U2D;
class
{
	SpriteAtlas _sprite = null;
    
    void LoadAtlasFunc()
    {
    	_sprite = Resources.Load<SpriteAtlas>("path"); 
        //path = 아틀라스 경로 및 이름
        //예) Assets/Resources/Atlas/ResourceAtlas => "Atlas/ResourceAtals"
        
        Sprite _exSprite = _sprite.GetSprite("name");
        //name = atlas에 저장된 확장자를 제외한 이미지 파일명
        //예) imageExample.png => "imageExample"
    }
}
728x90
반응형