UnityEditor.Editor.OnPreviewGUI C# (CSharp) Method

OnPreviewGUI() public method

Implement to create your own custom preview for the preview area of the inspector, primary editor headers and the object selector.

public OnPreviewGUI ( Rect r, GUIStyle background ) : void
r UnityEngine.Rect Rectangle in which to draw the preview.
background UnityEngine.GUIStyle Background image.
return void
        public virtual void OnPreviewGUI(Rect r, GUIStyle background)
        {
            this.preview.OnPreviewGUI(r, background);
        }

Usage Example

Esempio n. 1
0
        public override void OnGUI(Rect rect)
        {
            if (m_Editor == null)
            {
                editorWindow.Close();
                return;
            }

            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }


            // Toolbar
            GUILayout.BeginArea(new Rect(rect.x, rect.y, rect.width, kToolbarHeight), s_Styles.toolbar);
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            m_Editor.OnPreviewSettings();
            EditorGUILayout.EndHorizontal();
            GUILayout.EndArea();

            const float kMaxSettingsWidth = 140f;

            GUI.Label(new Rect(rect.x + 5f, rect.y, rect.width - kMaxSettingsWidth, kToolbarHeight), m_ObjectName, s_Styles.toolbarText);

            // Object preview
            Rect previewRect = new Rect(rect.x, rect.y + kToolbarHeight, rect.width, rect.height - kToolbarHeight);

            m_Editor.OnPreviewGUI(previewRect, s_Styles.background);
        }
All Usage Examples Of UnityEditor.Editor::OnPreviewGUI