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.

ObjectPreview

class in UnityEditor

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

Descripción

Base Class to derive from when creating Custom Previews.

You specify which type is the preview for, by using the ObjectPreview attribute. Below you can see an small example that will display the name of the object being inspected.

[CustomPreview(typeof(GameObject))]
public class MyPreview : ObjectPreview
{
	public override bool HasPreviewGUI()
	{
		return true;
	}

public override void OnPreviewGUI(Rect r, GUIStyle background) { GUI.Label(r, target.name + " is being previewed"); } }

Variables

targetThe object currently being previewed.

Funciones Públicas

DrawPreviewThis is the first entry point for Preview Drawing.
GetInfoStringImplement this method to show object information on top of the object preview.
GetPreviewTitleOverride this method if you want to change the label of the Preview area.
HasPreviewGUICan this component be Previewed in its current state?
InitializeCalled when the Preview gets created with the objects being previewed.
MoveNextTargetCalled to iterate through the targets, this will be used when previewing more than one target.
OnInteractivePreviewGUIImplement to create your own interactive custom preview. Interactive custom previews are used in the preview area of the inspector and the object selector.
OnPreviewGUIImplement to create your own custom preview for the preview area of the inspector, primary editor headers and the object selector.
OnPreviewSettingsOverride this method if you want to show custom controls in the preview header.
ResetTargetCalled to Reset the target before iterating through them.