/// Safe area implementation for notched mobile devices. Usage:
/// (1) Add this component to the top level of any GUI panel.
/// (2) If the panel uses a full screen background image, then create an immediate child and put the component on that instead, with all other elements childed below it.
/// This will allow the background image to stretch to the full extents of the screen behind the notch, which looks nicer.
/// (3) For other cases that use a mixture of full horizontal and vertical background stripes, use the Conform X & Y controls on separate elements as needed.
/// </summary>
publicclassSafeArea:MonoBehaviour
{
#regionSimulations
/// <summary>
/// Simulation device that uses safe area due to a physical notch or software home bar. For use in Editor only.
/// </summary>
publicenumSimDevice
{
/// <summary>
/// Don't use a simulated safe area - GUI will be full screen as normal.
/// </summary>
None,
/// <summary>
/// Simulate the iPhone X and Xs (identical safe areas).
/// </summary>
iPhoneX,
/// <summary>
/// Simulate the iPhone Xs Max and XR (identical safe areas).
/// </summary>
iPhoneXsMax,
/// <summary>
/// Simulate the Google Pixel 3 XL using landscape left.
/// </summary>
Pixel3XL_LSL,
/// <summary>
/// Simulate the Google Pixel 3 XL using landscape right.
/// </summary>
Pixel3XL_LSR
}
/// <summary>
/// Simulation mode for use in editor only. This can be edited at runtime to toggle between different safe areas.
/// </summary>
publicstaticSimDeviceSim=SimDevice.None;
/// <summary>
/// Normalised safe areas for iPhone X with Home indicator (ratios are identical to Xs, 11 Pro). Absolute values:
/// PortraitU x=0, y=102, w=1125, h=2202 on full extents w=1125, h=2436;
/// PortraitD x=0, y=102, w=1125, h=2202 on full extents w=1125, h=2436 (not supported, remains in Portrait Up);
/// LandscapeL x=132, y=63, w=2172, h=1062 on full extents w=2436, h=1125;
/// LandscapeR x=132, y=63, w=2172, h=1062 on full extents w=2436, h=1125.