Screen.safeArea not correct for Pixel 4, Unity 2018.4

Unity 2018.4.23, Screen.safeArea is returning a zero offset, but the phone has rounded corners. Tested this in an update loop, so it's not an Awake/Start issue.

Are there known problems with Screen.safeArea and Android in 2018.4?

Note: Pixel 4 runs Android 10.

Tested with latest 2018.4 available (2018.3.26f1) and same results. Safe area is the full screen.

In case API level is a factor:

Minimum API level is 19, Target API level is highest available (which is shown as level 28).

Are other people using Screen.safearea OK on Android? Maybe it's just best to assume a worst case, and move all UI away from the edges.

Bump... anyone out there using Screen.safearea successfully on Android for 2018.8.4?

Is this the wrong forum to ask this question?

Someone will find this thread in 2025 and wish someone had followed up.

It's not 2025, but I do wish someone responded to this. Have the same issue. Did you ever find a solution? I am on 2019.4.4

I was never able to find a way to get a non-zero safe area. The work-around was to just assume a worst-case safe area, which really sucks.

That's unfortunate. I tried 2020x, 2019x, SDK 28. Doesnt work on Android, fine on iOS :(

2019.4.23LTS in android. Same Problem. Safe area is the full screen, and Screen.Cutouts is empty.

Experiencing the same issue - anyone have a fix for this? Without a way to detect rounded corners, UI elements in my game end up getting cut off.

Is it a Unity issue or is the phone not reporting any safe areas? If it's the latter, there isn't much Unity can do.

Using the device simulator, the iPhone X has a correct safe area like this:
7144283--854771--upload_2021-5-15_17-17-19.png
On the other hand, the Pixel 4's safe area goes outside of the corners:
7144283--854774--upload_2021-5-15_17-17-57.png
This is strange because the device simulator clearly recognizes that the Pixel 4 has rounded corners, yet the safe area ignores them.


The safe areas are something that the phone itself reports, there are iOS APIs and Android APIs that Unity then takes and maps to Screen.safeArea.

If the phone itself doesn't report any insets / safe areas, then there's not much for Unity to do.


If this is the case, I'm wondering how other developers handle this? Especially if phones as prominent as the Google Pixel don't report this.

Never place anything too close to the corners?

7144514--854804--upload_2021-5-16_3-1-25.png

But if you really wanted to, you could have code that detects the pixel phone and override safeArea with your own values.

But it generally seems like all Androids don't really inset because of rounded corners.

Even Apple don't think does it because of rounded corners, they just do it so there's symmetry. (I'm fairly sure if they got rid of the notch but kept the rounded corners, the safeArea would be full screen).

Well the point is I'd like the UI to be consistent between Android and iOS. If a button is pushed away from the screen edge on iOS due to a rounded corner, it would look strange to have that same button against the edge on Android.

I am aware that Screen.safeArea is reported by the device and that Android handles corners differently; regardless, Android also has an additional RoundedCorner API that I want to access in Unity to compute my own custom safe area. So the question is, how to access it in Unity?


It’s not due to a rounded corner, Apple did it this way to keep it symmetrical, which you could do by calculated the side offsets and applying the highest one for both sides.

Also about the rounded corners API is something you could probably write a plugin for. Don’t expect Unity to do it for you.


That's definitely not true. If you go to the safe area visualizer for the iPhone X, you'll see that the border is significantly larger than the notch in order to fully exclude the rounded corners:
7294261--882652--upload_2021-7-2_23-1-19.png
The safe area shape exactly matches the rounded corners. If it was only to match the notch size, you'd expect the safe area to partially cut into the rounded corners.

As a matter of fact, if you simulate the iPad Pro 11, which doesn't have any notches but does have rounded corners, you'll see that the safe area cuts out the corners:
7294261--882658--upload_2021-7-2_23-11-2.png
This same cut does not happen on the iPad Pro 10, which has all regular corners.


For an issue so common that someone started an entire thread about it with multiple people commenting wondering why the corners aren't considered, I'd want to at least make sure that Unity didn't already implement it before going out of my way to write a plugin. If I have to write a plugin, I'll do it, but it seems strange that a common issue doesn't have any built-in support.


Welcome to Unity.