ObjectPreview

class in UnityEditor

Switch to Manual

Description

Base Class to derive from when creating Custom Previews.

You specify which type is the preview for by using the CustomPreview attribute derived from ObjectPreview. Below you can see an small example that will display the name of the object being inspected. The preview window will appear at the bottom of the Inspector window.

using UnityEngine;
using UnityEditor;

[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.

Public Functions

DrawPreviewThis is the first entry point for Preview Drawing.
GetInfoStringImplement this method to show object information on top of the object preview.
GetPreviewTitleПереопределите этот метод, если вы хотите изменить название области предпросмотра (preview).
HasPreviewGUIМожет ли этот компонент быть предпросмотрен в своем текущем состоянии?
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.
OnInteractivePreviewGUIРеализуйте, чтобы создать ваш собственный интерактивный предпросмотр. Интерактивные предпросмотры используются в области предпросмотра окна Inspector и при выборе объекта.
OnPreviewGUIРеализуйте, чтобы создать ваш собственный предпросмотр в области предпросмотра инспектора, основных заголовках редактора и при выборе объекта.
OnPreviewSettingsПереопределите этот метод, если вы хотите показать пользовательские элементы в заголовке предпросмотра.
ResetTargetCalled to Reset the target before iterating through them.