// [RMS] assumes all shaders have parameter _AlphaScale available (!)
        public static void SetAlphaMultiply(this GameObject go, float fScale)
        {
            Renderer r = go.GetComponent <Renderer>();

            if (r != null)
            {
                r.material.SetFloat("_AlphaScale", fScale);
            }
            CustomAlphaMultiply c = go.GetComponent <CustomAlphaMultiply>();

            if (c != null)
            {
                c.SetAlphaMultiply(fScale);
            }
        }
Exemple #2
0
        // [RMS] assumes all shaders have parameter _AlphaScale available (!)
        public static void SetAlphaMultiply(this GameObject go, float fScale)
        {
            // [RMS] assume if we have custom handling we shouldn't do default handling?
            CustomAlphaMultiply c = go.GetComponent <CustomAlphaMultiply>();

            if (c != null)
            {
                c.SetAlphaMultiply(fScale);
            }
            else
            {
                Renderer r = go.GetComponent <Renderer>();
                if (r != null)
                {
                    r.material.SetFloat("_AlphaScale", fScale);
                }
            }
        }