Show / Hide Table of Contents

Class NotchSolutionUIBehaviourBase

A base class to derive from if you want to make a notch-aware UnityEngine.EventSystems.UIBehaviour component. UpdateRect() will be called at the "correct moment". You change the rectTransform as you like in there.

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
UnityEngine.EventSystems.UIBehaviour
NotchSolutionUIBehaviourBase
SafePadding
Implements
UnityEngine.UI.ILayoutSelfController
UnityEngine.UI.ILayoutController
INotchSimulatorTarget
Namespace: E7.NotchSolution
Assembly: E7.NotchSolution.dll
Syntax
[DisallowMultipleComponent]
[RequireComponent(typeof(RectTransform))]
public abstract class NotchSolutionUIBehaviourBase : UIBehaviour, ILayoutSelfController, ILayoutController, INotchSimulatorTarget
Remarks

It helps you store the simulated values from Notch Simulator and expose them as protected fields. Plus you can use GetCanvasRect() to travel to the closest UnityEngine.Canvas that is this component's parent. Usually you will want to do something related to the "entire screen".

Fields

m_Tracker

Declaration
protected DrivenRectTransformTracker m_Tracker
Field Value
Type Description
UnityEngine.DrivenRectTransformTracker

Properties

rectTransform

Declaration
protected RectTransform rectTransform { get; }
Property Value
Type Description
UnityEngine.RectTransform

SafeAreaRelative

Already taken account whether should trust Notch Simulator or Unity's Device Simulator package.

Declaration
protected Rect SafeAreaRelative { get; }
Property Value
Type Description
UnityEngine.Rect

Methods

GetCanvasRect()

Declaration
protected Rect GetCanvasRect()
Returns
Type Description
UnityEngine.Rect

OnDisable()

Overrides UnityEngine.EventSystems.UIBehaviour

Declaration
protected override void OnDisable()
Overrides
UnityEngine.EventSystems.UIBehaviour.OnDisable()

OnEnable()

Overrides UnityEngine.EventSystems.UIBehaviour

Declaration
protected override void OnEnable()
Overrides
UnityEngine.EventSystems.UIBehaviour.OnEnable()

OnRectTransformDimensionsChange()

Overrides UnityEngine.EventSystems.UIBehaviour. This doesn't work when flipping the orientation to opposite side (180 deg). It only works for 90 deg. rotation because that makes the rect transform changes dimension.

Declaration
protected override void OnRectTransformDimensionsChange()
Overrides
UnityEngine.EventSystems.UIBehaviour.OnRectTransformDimensionsChange()

UpdateRect()

Declaration
protected abstract void UpdateRect()

Explicit Interface Implementations

INotchSimulatorTarget.SimulatorUpdate(Rect, Rect[])

Declaration
void INotchSimulatorTarget.SimulatorUpdate(Rect simulatedSafeAreaRelative, Rect[] simulatedCutoutsRelative)
Parameters
Type Name Description
UnityEngine.Rect simulatedSafeAreaRelative
UnityEngine.Rect[] simulatedCutoutsRelative

ILayoutController.SetLayoutHorizontal()

Declaration
void ILayoutController.SetLayoutHorizontal()

ILayoutController.SetLayoutVertical()

Declaration
void ILayoutController.SetLayoutVertical()

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