private void Awake()
        {
            m_editor = GetComponent <PBBaseEditor>();

            MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>();

            if (meshFilter == null)
            {
                meshFilter = gameObject.AddComponent <MeshFilter>();
            }
            meshFilter.sharedMesh = new Mesh();

            MeshRenderer renderer = gameObject.GetComponent <MeshRenderer>();

            if (renderer == null)
            {
                renderer = gameObject.AddComponent <MeshRenderer>();
            }

            m_material = new Material(Shader.Find(BuiltinMaterials.faceShader));
            m_material.SetFloat("_Dither", 1f);
            m_material.color        = m_color;
            renderer.sharedMaterial = m_material;

            gameObject.AddComponent <PBMesh>();
            gameObject.layer = m_editor.GraphicsLayer;
            m_selectionMesh  = GetComponent <ProBuilderMesh>();
        }
        private void Awake()
        {
            m_editor = GetComponent <PBBaseEditor>();

            MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>();

            if (meshFilter == null)
            {
                meshFilter = gameObject.AddComponent <MeshFilter>();
            }
            meshFilter.sharedMesh = new Mesh();

            m_renderer = gameObject.GetComponent <MeshRenderer>();
            if (m_renderer == null)
            {
                m_renderer = gameObject.AddComponent <MeshRenderer>();
            }

            m_material = new Material(Shader.Find("Battlehub/RTBuilder/FaceHighlight"));
            m_material.SetFloat("_Dither", 1f);
            m_material.SetInt("_HandleZTest", (int)CompareFunction.LessEqual);
            m_material.color = new Color(m_color.r, m_color.g, m_color.b, 0.5f);

            m_renderer.sharedMaterial = m_material;

            gameObject.AddComponent <PBMesh>();
            gameObject.layer = m_editor.GraphicsLayer;
            m_selectionMesh  = GetComponent <ProBuilderMesh>();
        }
Exemplo n.º 3
0
        private void Awake()
        {
            m_editor = GetComponent <PBBaseEditor>();

            m_material = new Material(Shader.Find(BuiltinMaterials.lineShader));
            m_material.SetColor("_Color", Color.white);
            m_material.SetInt("_HandleZTest", (int)m_zTest);
            m_material.SetFloat("_Scale", m_scale);
        }
        private void Awake()
        {
            m_editor = GetComponent <PBBaseEditor>();

            string vertShader = IsGeometryShadersSupported ?
                                PBBuiltinMaterials.pointShader :
                                PBBuiltinMaterials.dotShader;

            m_material = new Material(Shader.Find(vertShader));
            m_material.SetColor("_Color", Color.white);
            m_material.SetInt("_HandleZTest", (int)m_zTest);
            m_material.SetFloat("_Scale", m_scale);
        }