EditorGUIUtility.FindTexture 查找纹理
static function FindTexture (name : string) : Texture2D
Description描述
Get a texture from its source filename.
从源文件名获取一个纹理。
Checks the path of a texture.
检查纹理的路径。
// Simply editor window that lets you quick check a path of// a texture in your project instead of waiting your code to// compile.//快速检测纹理的路径,而不用等待代码编译// if the path exists then it shows a message// else displays an error message//如果路径存在,则显示一条消息,否则显示错误消息class EditorGUIUtilityFindTexture extends EditorWindow {var path : String = "";@MenuItem("Examples/Check Path For Texture")static function Init() {var window = GetWindow(EditorGUIUtilityFindTexture);window.position = Rect(0,0,180,55);window.Show();}function OnGUI() {path = EditorGUILayout.TextField("Path To Test:", path);if(GUILayout.Button("Check"))if(EditorGUIUtility.FindTexture(path)) {Debug.Log("Yay!, texture found at: " + path);} else {Debug.LogError("No texture found at: " + path + " Check your path");}}}