Created
April 25, 2019 07:04
-
-
Save gkagm2/1479ca7efe452912af023a7bc0e333a7 to your computer and use it in GitHub Desktop.
UISprite (NGUI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SpriteManager : MonoBehaviour { | |
public UISprite icon; | |
// Use this for initialization | |
void Start () { | |
} | |
// Update is called once per frame | |
void Update () { | |
if (Input.GetKeyDown(KeyCode.Alpha0)) | |
{ | |
icon.spriteName = "Berry_02"; //문자열로 스프라이트의 아이콘을 바꿀 수 있다. | |
} | |
if (Input.GetKeyDown(KeyCode.Alpha1)) | |
{ | |
icon.spriteName = "Book_00"; | |
} | |
if (Input.GetKeyDown(KeyCode.Alpha2)) | |
{ | |
icon.spriteName = "Book_03"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment