UnityEditor.Editor.OnInteractivePreviewGUI C# (CSharp) Method

OnInteractivePreviewGUI() public method

Implement to create your own interactive custom preview. Interactive custom previews are used in the preview area of the inspector and the object selector.

public OnInteractivePreviewGUI ( 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 OnInteractivePreviewGUI(Rect r, GUIStyle background)
        {
            this.OnPreviewGUI(r, background);
        }

Usage Example

示例#1
0
            public void OnGUI()
            {
                if (mat == null || mat.Material == null)
                {
                    return;
                }

                IsOpen = EditorGUILayout.Foldout(IsOpen, mat.Material.name);

                if (IsOpen && Editor == null)
                {
                    Editor = UnityEditor.Editor.CreateEditor(mat.Material, typeof(MaterialEditor));
                }

                if (!IsOpen && Editor != null)
                {
                    Destroy();
                    return;
                }

                if (IsOpen)
                {
                    EditorGUILayout.LabelField(mat.Material.shader.name);

                    Editor.OnInteractivePreviewGUI(
                        GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth - 32, 128), EditorStyles.helpBox);
                }
            }
All Usage Examples Of UnityEditor.Editor::OnInteractivePreviewGUI