Class SafeAdaptation
Adapt anything according to how much a screen space was taken by a single side of safe area.
It uses Playables API and animation playables to blend between the first frame of 2 UnityEngine.AnimationClip, which represent normal state and fully-adapted state. As long as something is keyable by the animation system, it could be adapted to the safe area.
Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
SafeAdaptation
Implements
Inherited Members
Namespace: E7.NotchSolution
Assembly: E7.NotchSolution.dll
Syntax
[HelpURL("https://exceed7.com/notch-solution/components/adaptation/safe-adaptation.html")]
public class SafeAdaptation : AdaptationBase, INotchSimulatorTarget
Remarks
Blend amount is 0 ~ 1, calculated from 0 ~ 1 relative screen space taken of a single side that is then evaluated through configurable E7.NotchSolution.BlendedClipsAdaptor.adaptationCurve.
By using animation system, the modification won't count as dirtying the scene which is great when you want to switching the simulator on and off just to observe its effect.
Animator is needed for its field binding power but no need for the controller asset, because we don't need the costly state machine, just like how UnityEngine.Playables.PlayableDirector works with animation playables.
However since Unity can't design UnityEngine.AnimationClip on the Animation pane without UnityEngine.Animation with controllers, you may need to temporarily add a controller when you are making the clip + add clips as some states in the animation graph, then remove the controller once you finished making the clip...
At runtime it only take effect on Start
, since safe area is not expected to change dynamically,
and unlike uGUI layout system + SafePadding, a frequent recalculation is not expected.
Call Adapt() if you wish to apply the adaptation manually again.
In edit mode, it also apply on notch simulator update. So it is almost like the adaptation always lock your fields.
In real play it is possible to adjust these adapted fields later freely since it's only on Start
.
Methods
Adapt()
At runtime SafeAdaptation only take effect on Start
, since safe area is not expected to change dynamically,
and unlike uGUI and SafePadding a frequent recalculation is not expected.
This method applies that adaptation manually again.
Declaration
public override void Adapt()