GetBounds(Type)
Returns the screen-space rectangle where an overlapping inset covers the application window.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Android
- Assembly: UnityEngine.AndroidJNIModule
public Rect GetBounds(AndroidWindowInsets.Type type)
Parameters
A single inset type to query. Passing combined flags throws an ArgumentException.
Returns
Type | Description |
|---|---|
| Rect | The screen-space rectangle where the overlapping inset covers the application window, or _zero if the inset is not overlapping. |
Remarks
Returns the bounds in Unity screen coordinates (origin bottom-left, y-up), matching the coordinate system of _safeArea. Returns _zero if the specified inset is not overlapping or if AndroidWindowInsets.Type.None is passed. Only a single inset type may be passed; passing combined flags throws an ArgumentException.
The returned rect accounts for resolution scaling when Screen.SetResolution is used.
Examples
using UnityEngine;using UnityEngine.Android;public class Controller : MonoBehaviour{ public void Update() { var statusBarBounds = AndroidApplication.currentWindowInsets.GetBounds(AndroidWindowInsets.Type.StatusBars); if (statusBarBounds.width > 0) Debug.Log("Status bar covers: " + statusBarBounds); }}