Unity 2017 New Features - Sprite atlas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.U2D; public class AtlasTest : MonoBehaviour { [SerializeField] private SpriteAtlas atlas; private SpriteRenderer myRenderer; // Use this for initialization void Start () { myRenderer = GetComponent<SpriteRenderer>(); //Get Sprite renderer into sprite object(2D Object -> Sprite) in unityeditor Hierachy myRenderer.sprite = atlas.GetSprite("snow"); //SpriteAtlas is created by "Create -> Sprite Atlas" and "Snow" is one of atla sprite image names. } // Update is called once per frame void Update () { } private void ChangeSprite() { } } | cs |
ref : https://youtu.be/3a-Ymcp_s-k
반응형
'게임엔진(GameEngine) > Unity3D' 카테고리의 다른 글
오클루전 컬링 과 Bake (0) | 2017.10.31 |
---|---|
에셋 번들에서 오브젝트를 로드, 언로드(비동기)와 빌드 (0) | 2017.10.19 |
How to get multiple files with different extension? C# unity (0) | 2017.10.12 |
Does DirectoryInfo GetFiles work on Android? => Don't but! (0) | 2017.10.11 |
Reading file from StreamingAssets, Android(StreamingAssets ) (0) | 2017.10.10 |