Fading a Text component with Shadow and Outline causes a problem

I am trying to fade a Unity UI

I ended up doing a work around that fades the outline alpha faster than the text alpha.

    // Property
    public Outline textOutline; // dragged on via inspector
    // ...
    // Called during fade coroutine
    textOutline.effectColor = new Color(textOutline.effectColor.r, textOutline.effectColor.g, textOutline.effectColor.b, canvasGroup.alpha / 3);

Where the 3 is just some scaleout value, and the canvasgroup.alpha is the alpha of the text object (in my case it was in a canvasgroup).

You should create a Canvas Group for the text. The canvas group alpha setting applies on its child UI items as a whole so that you can fade the composition.

There is also a bug with adjusting only the Text component alpha when the text has an Outline component too. Changing the alpha forces the Outline component to rebuild meshes and causes gc allocations / garbage. By using a canvas group that can be avoided.