要记得加下面的命名空间
using UnityEditor;
Texture2D texture;
void Start ()
{
texture = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/psb17.jpg",typeof(Texture2D));
}
void OnGUI()
{
GUI.DrawTexture(new Rect(0,0,texture.width,texture.height),texture);
}