Version: Unity 6.5 Alpha (6000.5)
Language : English
Input for Android devices
Android application size restrictions

Manage the visibility and behavior of Android system bars

Unity allows you to control the visibility of Android system bars and configure how they respond to gestures such as swiping from the screen edges. The Android system bar visibility determines how your application utilizes the available screen space to display its content.

The Android system bars are Android system UI elements that generate window insets when visible. Window insets define the screen area these UI elements occupy, restricting your application to use the remaining available screen space. The Android system bars include:

  • Status bar: Appears at the top of the screen and contains information such as time, battery, and notifications.
  • Navigation bar: Appears at the bottom of the screen and contains navigation elements to move to the previous, home, or recent applications.

You can control the Android system bars through the Insets section in the Android Player settingsSettings that let you set various player-specific options for the final game built by Unity. More info
See in Glossary
.

  • When you make the Android system bars visible, the application content is restricted to the area available on the device screen that excludes the visible system bars or physical display cutouts.
  • When you hide the Android system bars, the application content utilizes the full available screen space. This helps create a seamless full-screen user experience. Additionally, hiding the system bars reduces the risk of users exiting the application by mistake.

Note: On Android versions earlier than 15, the Render Outside Safe Area Player setting determines whether the full available screen space includes the area around physical display cutouts. On Android 15 and later, the Android operating system allows application content to extend over the display cutouts. However, in this case the application content cannot use the screen area Android system bars occupy when visible.

Configure Android system bars visibility and behavior

To configure Android system bars, follow these steps:

  1. In the Unity Editor, go to Edit > Project Settings > Player > Android.
  2. In the Resolution and Presentation settings, locate the Insets section.
  3. Disable the Status Bars and Navigation Bars checkboxes as required to hide the corresponding Android system bars.
  4. Select the required option in the System Bars Behavior dropdown.

Your application now hides the selected Android system bars and uses the available screen space.

The selected System Bars Behavior option controls how Android system bars respond to system gestures. The available dropdown options allow you display the system bars temporarily in a transparent format or keep displaying the system bars until they’re manually hidden again using AndroidWindowInsets.Hide.

Note: The Hide Navigation Bar Player setting is obsolete in new projects created using Unity versions 6000.5 and later. For existing projects with this setting enabled, the navigation bar remains disabled by default.

Detect Android system bars visibility and behavior changes

Use the AndroidApplication class methods to access Android system bars information.

  • The currentWindowInsets method provides current Android system bars visibility and behavior status.
  • The onWindowInsetsChanged method allows you to detect and handle any changes in the visibility and behavior at runtime.

Note: The onWindowInsetsChanged callback and the System Bars Behavior are supported on Android 11 (API 30) or later versions. On older devices, you need to detect changes in the insets manually. These devices always return undefined when detecting the current Android system bar behavior.

Additional resources

Input for Android devices
Android application size restrictions