using UnityEngine;
using System.Collections;
using UnityEditor;
public class Script1_1 : MonoBehaviour {
//贴图
Texture2D texture;
// Use this for initialization
void Start () {
//从project视图中记载资源
texture = (Texture2D)AssetDatabase.LoadAssetAtPath ("Assets/0.jpg",typeof(Texture2D));



}
void OnGUI(){
//渲染资源
GUI.DrawTexture (new Rect(0,0,texture.width,texture.height),texture);


}

// Update is called once per frame
void Update () {

}

}


注意using命名空间,,图片路径