# Not getting proper height in unity when android device has notch or navigation bar on screen

Screen.height is not giving the proper resolution of an Android device when that device has a notch or navigation bar.

Due to this there is offset at bottom of screen:

Here I have set the Admob banner to display at the bottom. But it shows with some offset away from the bottom edge of the screen.

How can I get the proper height of the device in Unity and work with the notch on devices that have them?

New contributor
Wrong Turn is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• Your question is unclear. When you say Screen.height does not give proper resolution, do you mean it returns the space your game occupies and not the actual screen space? Because that's what supposed to happen, at least on android versions where the navigation bar is never minimised. Also you mention "Due to this, there is offset at the bottom of the screen". This does not make sense to me, are you saying that Unity produces a game that by default does not occupy the whole screen? – TomTsagk Dec 6 at 11:29
• I meant when i use Screen.height it give me 2156 but my screen resolution is 1080 X 2246. So i should get 2246 and I am new to unity – Wrong Turn Dec 6 at 11:33

## 1 Answer

Screen.height returns the amount of pixels on the screen that are available to your app. In older versions of android the navigation bar would always remain static on the screen, eating a portion of it. This means that any app that runs does not have access on that portion of the screen. That is not an error, it's how the Android OS works, and in my opinion, it's the correct thing to do.

In newer versions, the navigation bar can get minimised if your app is set to run as fullscreen, which gives you access to the whole screen.

You also mention this causes a gap on the bottom of your screen. It's unclear why, unfortunately I can't give a solution to that unless you want to share some screenshots of what you mean.

• I think due to notch in device my game layout not show proper. So my problem is i cant find notch area of in android device. is there any way to find notch area in android device in unity? – Wrong Turn Dec 6 at 11:52
• @WrongTurn why do you need to find the notch area? The OS gives your game a specific space (Screen.width x Screen.height), you can only draw on that space. Android does not let developers mess with the notch so that it's not abused. – TomTsagk Dec 6 at 11:55