http://www.unitymanual.com/home.php?mod=space&uid=2452&do=blog&id=420

using UnityEngine;
using System.Collections; public class TestSprite : MonoBehaviour { public Sprite spriteA;
public Texture2D Tex;
// Use this for initialization
void Start () {
Tex = Resources.Load("Enter") as Texture2D; //Create(源资源,对应sprite的矩形,对应sprite的中心点坐标)
spriteA = Sprite.Create(Tex, new Rect(, , , ), new Vector2(0.5f, 0.5f));
gameObject.GetComponent<SpriteRenderer>().sprite = spriteA; } // Update is called once per frame
void Update () { }
}
05-11 18:20