版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010889653/article/details/72179514
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Pai : MonoBehaviour {
void Start()
{
Texture2D img = Resources.Load("Game/BJHH/MahJong/hand/1") as Texture2D;
Sprite pic = Sprite.Create(img, new Rect(0, 0, img.width, img.height), Vector2.zero);
Image ico = GetComponent<Image>();
ico.sprite = pic;
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Pai : MonoBehaviour {
void Start()
{
Texture2D img = Resources.Load("Game/BJHH/MahJong/hand/1") as Texture2D;
Sprite pic = Sprite.Create(img, new Rect(0, 0, img.width, img.height), Vector2.zero);
Image ico = GetComponent<Image>();
ico.sprite = pic;
}
}