I am working on a project in Unity for Android Portrait mode. I will constantly be modifying the textures of two RawImages, the catch is that the images must be the same width and height(1080x1080, 800x800) 1080x1079 is wrong. Because a lot of phones nowadays are notched, I'm forced to maintain all the UI Elements inside the SafeArea rect. BUT, I don't know how to get the y coordinate of the SafeArea rect relative to the Display. Here's a photo:
So, I only need to get the y coordinate of the SafeArea rect, by my guesses, for the Phone in the example, the y coordinate should be around 100 pixels height. Thank you in advance.
If you are using UI Scale Mode: Scale with screen size Like in this picture, here is my solution for adaptive RectTransform with your safe area (only Vertical):
Just attach this script to your RectTransform with stretched anchors and enjoy the result