I want to make a responsive scope UI.
The texture I use is a square that must keep its ratio, which I do by setting “Stretch Mode” to “Keep Aspect Centered”.
Now I want to black out the exterior parts (marked in red).
Using a ColorRect on the whole screen is not an option, because I need to keep the transparent parts without any background so that the player can see what he’s shooting.
I tried a lot of things, and I can’t do it. Using containers didn’t help. In every case, the node in charge of keeping the ratio takes all the space, so trying to patch the rest with ColorRects it useless.
Do also tell me if my approach of using UI and transparency is totally wrong.
Thanks,
Just add black sections to both sides of your texture image (so much that the resulting ratio is not useful at all, this helps the edges never remain blank) and apply these settings:
For me this worked, the image always keeps its height the same as the page and the corners are filled with extra space.