I know how to put a gradient across multiple shapes in Illustrator using compound path - however, in this specific case I have layers with other parts that need to show in front of each other - and using compound path unites those layers in front or behind (as one layer).
To show what I mean see image. I've drawn 3 cubes. I want one face to have one gradient. A single gradient on each is shown top right. Bottom left is what I want to achieve (that gradient stretched across all three) but crucially I need the blocks and layers still in order shown in the top right or top left set.
Important: I cannot CUT into/out these shapes because they will be part of an animation that shows the 3-sides of the cube, appearing one by one, moving into place.
My guess (but I don't know how to...) is make the compound layer as I have, then some keep that gradient as I release the compound layer, then reorder those layers back to where they were. Hopefully someone will know.