コード例 #1
0
 private void SetShader(eBtnEffectTpye type)
 {
     if (null == m_imgComponent.material)
     {
         return;
     }
     if (m_gray && type != eBtnEffectTpye.Gray)
     {
         return;
     }
     m_imgComponent.material.SetInt("_type", (int)type);
 }
コード例 #2
0
ファイル: UIButton.cs プロジェクト: DianBingx/demo
    private void SetShader(eBtnEffectTpye type)
    {
        if (m_image.material == null)
        {
            return;
        }
        if (m_gray && type != eBtnEffectTpye.Gray)
        {
            return;
        }

        if (m_image.material.shader == Shader.Find("UI/Default"))
        {
            m_image.material = new Material(Shader.Find("UI/Button"));
        }
        m_image.material.SetInt("_type", (int)type);
    }