I will refer to these three images to aid the explanation this question.
Suppose I have two GameObject
s in Unity 2D, both with Image
components attached. Further suppose that one of the GameObject
s overlaps the other in the scene space. This is illustrated in the first, leftmost image with a blue triangle above a red circle. The checkerboard background represents whatever else is in the scene, rendered partially underneath the red circle and blue triangle.
If I were to set the opacity of both of the GameObject
s to 0.5
(that is, their Color
is set to Color(1.0, 1.0, 1.0, 0.5)
), something like the second, middle image would be the result. There is a purple image where you can see the red circle through the blue triangle.
I do not want this. I instead want to create the effect as seen in the third, rightmost image, it is if the two images were combined into a single image, and then their opacity was set to 0.5
.
How can I do this?
I would also like to extend this to an arbitrary number of overlapping images, not just two.