UnityEditor.MaterialEditor.DefaultPreviewGUI C# (CSharp) Method

DefaultPreviewGUI() public method

public DefaultPreviewGUI ( Rect r, GUIStyle background ) : void
r UnityEngine.Rect
background UnityEngine.GUIStyle
return void
        public void DefaultPreviewGUI(Rect r, GUIStyle background)
        {
            if (!ShaderUtil.hardwareSupportsRectRenderTexture)
            {
                if (Event.current.type == EventType.Repaint)
                {
                    EditorGUI.DropShadowLabel(new Rect(r.x, r.y, r.width, 40f), "Material preview \nnot available");
                }
            }
            else
            {
                this.Init();
                Material target = this.target as Material;
                if (DoesPreviewAllowRotation(GetPreviewType(target)))
                {
                    this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, r);
                }
                if (Event.current.type == EventType.Repaint)
                {
                    this.m_PreviewUtility.BeginPreview(r, background);
                    this.DoRenderPreview();
                    this.m_PreviewUtility.EndAndDrawPreview(r);
                }
            }
        }

Usage Example

示例#1
0
 /// <summary>
 /// <para>Override for extending the rendering of the Preview area or completly replace the preview (by not calling base.OnMaterialPreviewGUI).</para>
 /// </summary>
 /// <param name="materialEditor">The MaterialEditor that are calling this method (the 'owner').</param>
 /// <param name="r">Preview rect.</param>
 /// <param name="background">Style for the background.</param>
 public virtual void OnMaterialPreviewGUI(MaterialEditor materialEditor, Rect r, GUIStyle background)
 {
     materialEditor.DefaultPreviewGUI(r, background);
 }
All Usage Examples Of UnityEditor.MaterialEditor::DefaultPreviewGUI
MaterialEditor