UnityEditor.ModelInspector.CreateWireframeMaterial C# (CSharp) Method

CreateWireframeMaterial() static private method

static private CreateWireframeMaterial ( ) : Material
return UnityEngine.Material
        internal static Material CreateWireframeMaterial()
        {
            Shader shader = Shader.FindBuiltin("Internal-Colored.shader");
            if (shader == null)
            {
                Debug.LogWarning("Could not find Colored builtin shader");
                return null;
            }
            Material material2 = new Material(shader) {
                hideFlags = HideFlags.HideAndDontSave
            };
            material2.SetColor("_Color", new Color(0f, 0f, 0f, 0.3f));
            material2.SetInt("_ZWrite", 0);
            material2.SetFloat("_ZBias", -1f);
            return material2;
        }

Usage Example

示例#1
0
        private void DrawMeshPreview(FrameDebuggerEventData curEventData, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
        {
            if (this.m_PreviewUtility == null)
            {
                this.m_PreviewUtility = new PreviewRenderUtility();
                this.m_PreviewUtility.m_CameraFieldOfView = 30f;
            }
            if ((UnityEngine.Object) this.m_Material == (UnityEngine.Object)null)
            {
                this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof(Material), "Default-Material.mat") as Material;
            }
            if ((UnityEngine.Object) this.m_WireMaterial == (UnityEngine.Object)null)
            {
                this.m_WireMaterial = ModelInspector.CreateWireframeMaterial();
            }
            this.m_PreviewUtility.BeginPreview(previewRect, (GUIStyle)"preBackground");
            ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
            this.m_PreviewUtility.EndAndDrawPreview(previewRect);
            string str = mesh.name;

            if (string.IsNullOrEmpty(str))
            {
                str = "<no name>";
            }
            string text = str + " subset " + (object)meshSubset + "\n" + (object)curEventData.vertexCount + " verts, " + (object)curEventData.indexCount + " indices";

            EditorGUI.DropShadowLabel(meshInfoRect, text);
        }
All Usage Examples Of UnityEditor.ModelInspector::CreateWireframeMaterial