Show / Hide Table of Contents

Class SafePadding

Make the UnityEngine.RectTransform of object with this component driven into full stretch to its immediate parent, then apply padding according to device's reported UnityEngine.Screen.safeArea.

Therefore makes an area inside this object safe for input-receiving components. Then it is possible to make other objects safe area responsive by anchoring their positions to this object's edges while being a child object.

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
UnityEngine.EventSystems.UIBehaviour
NotchSolutionUIBehaviourBase
SafePadding
Implements
UnityEngine.UI.ILayoutSelfController
UnityEngine.UI.ILayoutController
INotchSimulatorTarget
Inherited Members
NotchSolutionUIBehaviourBase.m_Tracker
NotchSolutionUIBehaviourBase.SafeAreaRelative
NotchSolutionUIBehaviourBase.rectTransform
NotchSolutionUIBehaviourBase.OnEnable()
NotchSolutionUIBehaviourBase.OnDisable()
NotchSolutionUIBehaviourBase.OnRectTransformDimensionsChange()
NotchSolutionUIBehaviourBase.ILayoutController.SetLayoutHorizontal()
NotchSolutionUIBehaviourBase.ILayoutController.SetLayoutVertical()
NotchSolutionUIBehaviourBase.INotchSimulatorTarget.SimulatorUpdate(Rect, Rect[])
NotchSolutionUIBehaviourBase.GetCanvasRect()
Namespace: E7.NotchSolution
Assembly: E7.NotchSolution.dll
Syntax
[DisallowMultipleComponent]
[RequireComponent(typeof(RectTransform))]
[HelpURL("https://exceed7.com/notch-solution/components/ui-behaviour/safe-padding.html")]
public class SafePadding : NotchSolutionUIBehaviourBase, ILayoutSelfController, ILayoutController, INotchSimulatorTarget
Remarks

Safe area defines an area on the phone's screen where it is safe to place your game-related input receiving components without colliding with other on-screen features on the phone. Usually this means it is also "visually safe" as all possible notches should be outside of safe area.

The amount of padding is a UnityEngine.Screen.safeArea interpolated into UnityEngine.RectTransform of root UnityEngine.Canvas found traveling up from this object. It should be a direct child of top canvas, or deeper child of some similarly full stretch rect in order to look right, although in reality it just pad in the shape of UnityEngine.Screen.safeArea regardless of its parent rectangle size.

Methods

UpdateRect()

Declaration
protected override void UpdateRect()
Overrides
NotchSolutionUIBehaviourBase.UpdateRect()

Implements

UnityEngine.UI.ILayoutSelfController
UnityEngine.UI.ILayoutController
INotchSimulatorTarget
In This Article
Back to top
A Unity plugin by 5argon from Exceed7 Experiments. Problems/suggestions/contact : 5argon@exceed7.com Discord