UnityEditor.SubstanceImporterInspector.GetSelectedMaterialInspector C# (CSharp) Method

GetSelectedMaterialInspector() private method

private GetSelectedMaterialInspector ( ) : Editor
return Editor
        private Editor GetSelectedMaterialInspector()
        {
            ProceduralMaterial selectedMaterial = this.GetSelectedMaterial();
            if (((selectedMaterial == null) || (this.m_MaterialInspector == null)) || (this.m_MaterialInspector.target != selectedMaterial))
            {
                EditorGUI.EndEditingActiveTextField();
                Object.DestroyImmediate(this.m_MaterialInspector);
                this.m_MaterialInspector = null;
                if (selectedMaterial != null)
                {
                    this.m_MaterialInspector = Editor.CreateEditor(selectedMaterial);
                    if (!(this.m_MaterialInspector is ProceduralMaterialInspector) && (this.m_MaterialInspector != null))
                    {
                        if (selectedMaterial.shader != null)
                        {
                            Debug.LogError("The shader: '" + selectedMaterial.shader.name + "' is using a custom editor deriving from MaterialEditor, please derive from ShaderGUI instead. Only the ShaderGUI approach works with Procedural Materials. Search the docs for 'ShaderGUI'");
                        }
                        Object.DestroyImmediate(this.m_MaterialInspector);
                        this.m_MaterialInspector = Editor.CreateEditor(selectedMaterial, typeof(ProceduralMaterialInspector));
                    }
                    ((ProceduralMaterialInspector) this.m_MaterialInspector).DisableReimportOnDisable();
                }
            }
            return this.m_MaterialInspector;
        }