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

by Wrong Turn   Last Updated December 06, 2018 12:13 PM

Scree.height not giving proper resolution of android device when device has notch or navigation bar. Due to this there is offset at bottom of screen. So how to get proper height of device in unity and work with notch device. And how to hide navigation bar in android.

Tags : unity android


Answers 2


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.

TomTsagk
TomTsagk
December 06, 2018 11:41 AM

enter image description here

Check this image. I have set Admob banner to bottom. But i show at bottom with some offset.

Wrong Turn
Wrong Turn
December 06, 2018 12:04 PM

Related Questions


Updated December 08, 2017 16:13 PM

Updated December 18, 2017 01:13 AM

Updated June 22, 2016 08:05 AM

Updated November 14, 2018 09:13 AM

Updated June 22, 2016 08:05 AM