반응형
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

반응형

+ Recent posts