Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

EditorGUIUtility.FindTexture

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function FindTexture(name: string): Texture2D;
public static Texture2D FindTexture(string name);

Parámetros

Descripción

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");
				}
		}
	}

Note that this function is used for searching for editor icons only.