Unity3D
NGUI Create Sprite and set Atlas runtime
일등하이
2012. 9. 28. 15:16
반응형
아틀라스 제작시 이름을 부여하여 여러장의 이미지 시트를 만듭니다.
버튼을 눌렀을때 해당아틀라스의 특정 이름의 이미지를 붙이는데 성공
자료도 너무없고 삽질도 많이 했지만 뿌듯
using UnityEngine;
using System.Collections;
public class ImageLoader : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void LoadImage(){
UISlicedSprite sp = NGUITools.AddWidget<UISlicedSprite>(GameObject.Find("Panel"));
sp.atlas = (Resources.Load("Fantasy Atlas 1") as GameObject).GetComponent<UIAtlas>();
sp.spriteName = "Window";
}
}
반응형