예제 #1
0
 /// <summary>
 /// 从Resources下读取文件,创建一个Sprite.
 /// 不要添加".png"
 /// </summary>
 /// <param name="imgPath"></param>
 /// <returns></returns>
 public void SetImage(string imgPath)
 {
     if (string.IsNullOrEmpty(imgPath))
     {
         image.sprite = null;
     }
     else
     {
         image.sprite = TextureManager.CreateSprite(imgPath);
     }
 }
예제 #2
0
 public void SetBackground(string imgPath)
 {
     if (string.IsNullOrEmpty(imgPath))
     {
         Background.sprite = null;
     }
     else
     {
         Background.sprite = TextureManager.CreateSprite(imgPath);
     }
 }