Notifications
Important
If you want to display more than one notification at the same time,
then notification container should have layout group component like EasyLayout.
Start positions of notifications are determined with Group Position.
Note
See Notifications Animations for open and closed animations.
Options
Hide Button
ButtonButton to close notification.
Animate On Hide Button
boolRun hide animation on HideButton click.
Text
Text(obsolete)GameObject to display the notification text. Replaced with NotifyInfo.
Animate On Hide Button
boolIf enabled the hide animation will run on
Hide Buttonclick.Hide Delay
floatDelay before notification automatically hidden.
Unscaled Time
boolDelay with unscaled time.
Slide Up On Hide
boolStart slide up animations after hide current notification. Turn it off if its managed with HideAnimation.
Notify Info
NotifyInfoBaseComponent to display the notification message.
Close Button
ButtonButton to close notification.
Buttons Container
RectTransformButtons container. If container not specified will be used parent of the button template.
Show() Method Parameters
message also can be specified with SetMessage()message
stringNotification message.Can be changed withSetMessage()method.customHideDelay
float?Time before notification hidden orhideAnimationstart running.Can be changed withHideDelayfield.container
Transform?Notifications container. Should haveLayout Groupcomponentto display multiple notifications.Can be changed withSetContainer()method.showAnimation
Func<TNotification, IEnumerator>Show animation. Can be changed with
ShowAnimationfield.Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
hideAnimation
Func<TNotification, IEnumerator>Hide animation. Can be changed with
HideAnimationfield.Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
slideUpOnHide
bool?Obsolete.UseEasyLayout.MovementAnimationinstead.sequenceType
NotifySequenceAdd notification to sequence and display in order according to the specified
sequenceType.sequenceDelay
floatTime between previous notification was hidden and this will be displayed.Can be changed withSequenceDelayfield.clearSequence
boolClear notifications sequence.
newUnscaledTime
bool?Animations will use unscaled time.
content
RectTransformNotification content.Can be changed withSetContent().onReturn
ActionAction called when instance return to the cache.Can be changed withOnReturnfield.onHide
Action<TNotification>Action called when instance return to the cache.Can be changed withOnNotificationHidefield.
ShowAsync() Method Parameters
message also can be specified with SetMessage() to use formatted strings.-1 if notification was hidden after delay or on hide button click.message
stringNotification message.Can be changed withSetMessage()method.customHideDelay
float?Time before notification hidden orhideAnimationstart running.Can be changed withHideDelayfield.container
Transform?Notifications container. Should haveLayout Groupcomponent to display multiple notifications.Can be changed withSetContainer()method.showAnimation
Func<TNotification, IEnumerator>Show animation. Can be changed with
ShowAnimationfield.Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
hideAnimation
Func<TNotification, IEnumerator>Hide animation. Can be changed with
HideAnimationfield.Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
slideUpOnHide
bool?Obsolete. UseEasyLayout.MovementAnimationinstead.sequenceType
NotifySequenceAdd notification to sequence and display in order according to the specified
sequenceType.sequenceDelay
floatTime between previous notification was hidden and this will be displayed.Can be changed withSequenceDelayfield.clearSequence
boolClear notifications sequence.
newUnscaledTime
bool?Animations will use unscaled time.
content
RectTransformNotification content.Can be changed withSetContent().closeOnButtonClick
boolClose notification on button click.
Events
OnAnimationStart
UnityEvent<bool>The event is raised before the animation starts.
Arguments: true if opening animation; false if closing animation.
Minimal code
// get notification instance by template name (name of existing GameObject with NotificationBase component).
var notification = notificatetionTemplate.Clone();
// show notification
notification.Show();
Advanced
var notification = notificatetionTemplate.Clone();
// show notification
notification.Show(
// Show notification with following text
message: "Simple Notification.",
// Hide it after 4.5 seconds
customHideDelay = 4.5f
);
Default Hide Animations
Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
Note
Hide Animation is coroutine that accepts NotificationBase instance and play hide animation for this instance.
You can specify any custom coroutine.
- AnimationRotateHorizontal
Rotate notification on X axis.
- AnimationRotateVertical
Rotate notification on Y axis.
- AnimationCollapseHorizontal
Resize width of the notification.
- AnimationCollapseVertical
Resize height of the notification.
- AnimationSlideRight
Slide notification on right.
- AnimationSlideLeft
Slide notification on left.
- AnimationSlideUp
Slide notification on up.
- AnimationSlideDown
Slide notification on down.
Default Show Animations
Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
Note
Show Animation is coroutine that accepts NotificationBase instance and play show animation for this instance.
You can specify any custom coroutine.
- ShowAnimationRotateHorizontal
Rotate notification on X axis.
- ShowAnimationRotateVertical
Rotate notification on Y axis.
- ShowAnimationCollapseHorizontal
Resize width of the notification.
- ShowAnimationCollapseVertical
Resize height of the notification.
- ShowAnimationSlideRight
Slide notification from right.
- ShowAnimationSlideLeft
Slide notification from left.
- ShowAnimationSlideUp
Slide notification from top.
- ShowAnimationSlideDown
Slide notification from bottom.
Configurable Hide Animations
Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
HideAnimationRotateBase
Arguments:
NotificationBasenotificationNotification instance.
boolisHorizontalRotate in horizontal or vertical direction.
floattimeLengthLength of animations in seconds.
HideAnimationCollapseBase
Arguments:
NotificationBasenotificationNotification instance.
boolisHorizontalResize in horizontal or vertical direction.
floatspeedResize speed in points per second.
HideAnimationSlideBase
Arguments:
NotificationBasenotificationNotification instance.
boolisHorizontalSlide in horizontal or vertical direction.
floatdirectionSlide direction, -1f for left/down, +1f for right/up.
floatspeedSlide speed in points per second.
boolanimateReplacementAnimate other notifications.
NotificationTemplate.Clone().Show(
"Notification message.",
customHideDelay: 3f,
hideAnimation: x => NotificationBase.HideAnimationSlideBase(x, true, -1f, 200f, true)
);
Configurable Show Animations
Warning
Obsolete. It is recommended to use Notifications Animations for open and closed animations.
ShowAnimationRotateBase
Arguments:
NotificationBasenotificationNotification instance.
boolisHorizontalRotate in horizontal or vertical direction.
floattimeLengthLength of animations in seconds.
ShowAnimationCollapseBase
Arguments:
NotificationBasenotificationNotification instance.
boolisHorizontalResize in horizontal or vertical direction.
floatspeedResize speed in points per second.
ShowAnimationSlideBase
Arguments:
NotificationBasenotificationNotification instance.
boolisHorizontalSlide in horizontal or vertical direction.
floatdirectionSlide direction, -1f for left/down, +1f for right/up.
floatspeedSlide speed in points per second.
boolanimateReplacementAnimate other notifications.
NotificationTemplate.Clone().Show(
"Notification message.",
customHideDelay: 3f,
showAnimation: x => NotificationBase.ShowAnimationSlideBase(x, true, -1f, 200f, true)
);
Custom Notifications
You can create derived class with own methods.
public class MyNotify : NotificationCustom<MyNotify>
{
// ...
}