// Don't change the emission key; this class caches it for performance.
            public void Update(float time, MaterialCached[] caches)
            {
                float value = curve.Evaluate(time);

                bool _keyEnabled        = value != 0f;
                bool mustUpdateKeyState = false;

                if (_keyEnabled != keyEnabled)
                {
                    keyEnabled         = _keyEnabled;
                    mustUpdateKeyState = true;
                }

                for (int i = 0; i < caches.Length; i++)
                {
                    MaterialCached cache       = caches[i];
                    Material       material    = cache.material;
                    Material       srcMaterial = cache.srcMaterial;

                    if (mustUpdateKeyState)
                    {
                        material.SetActiveKeyword(StandardUtil.KEY_EMISSION, keyEnabled);
                    }

                    Color srcColor = srcMaterial.GetEmissionColor();

                    material.SetEmissionColor(new Color {
                        r = (dstColor.r - srcColor.r) * value + srcColor.r,
                        g = (dstColor.g - srcColor.g) * value + srcColor.g,
                        b = (dstColor.b - srcColor.b) * value + srcColor.b,
                    });
                }
            }
            // Don't change any properties related to transparency; this class caches them for performance.
            public void Update(float time, MaterialCached[] caches)
            {
                float value = curve.Evaluate(time);

                bool _transparent        = value < 1f;
                bool invisible           = Mathf.Approximately(value, 0f);
                bool mustUpdateBlendMode = false;

                if (_transparent != transparent)
                {
                    transparent         = _transparent;
                    mustUpdateBlendMode = true;
                }

                for (int i = 0; i < caches.Length; i++)
                {
                    MaterialCached         cache       = caches[i];
                    Material               material    = cache.material;
                    Material               srcMaterial = cache.srcMaterial;
                    StandardUtil.BlendMode srcMode     = cache.srcMode;

                    if (mustUpdateBlendMode)
                    {
                        // If the material is not transparent by default:
                        if (srcMode != StandardUtil.BlendMode.Cutout)
                        {
                            if (transparent)
                            {
                                // Make it Fade.
                                material.SetBlendMode(StandardUtil.BlendMode.Fade);
                            }
                            else
                            {
                                // Turn back to its original transparency setting.
                                material.SetBlendMode(srcMode);
                            }
                        }
                    }

                    Color dstColor = srcMaterial.GetColor(StandardUtil.COLOR);
                    dstColor.a *= value;
                    material.SetColor(StandardUtil.COLOR, dstColor);

                    cache.renderer.enabled = !invisible;
                }
            }