Popup
Note
See Windows Animations for open and closed animations.
Options
Title Text
Text(obsolete)GameObject to display title. Replaced with the DialogInfo.
Content Text
Text(obsolete)GameObject to display text. Replaced with the DialogInfo.
Icon
Image(obsolete)GameObject to display icon. Replaced with the DialogInfo.
Info
DialogInfoBaseComponent to display the popup info.
AutoFocus
boolSet focus to the last Selectable object in the Popup.
CloseButton
ButtonButton to close popup.
Hide on Modal Click
boolClose popup on click on the background if the
modaloption enabled.
Events
OnAnimationStart
UnityEvent<bool>The event is raised before the animation starts.
Arguments: true if opening animation; false if closing animation.
Show() Method Parameters
title and message also can be specified with SetInfo() to use formatted strings.title
stringPopup title.Can be changed withSetInfo()method.message
stringPopup message.Can be changed withSetInfo()method.position
Vector3?Popup position.Can be changed withSetPosition().icon
SpritePopup icon.Can be changed withSetInfo()method.modal
boolModal popup.Can be changed withSetModal().modalSprite
SpriteBackground image for the modal popup.Can be changed withSetModal().modalColor
Color?Background color for the modal popup.Can be changed withSetModal().canvas
CanvasCanvas to display popup. Required if popup template is prefab.Can be changed withSetCanvas().content
RectTransformDialog content. Can be used instead of the message and icon.Can be changed withSetContent().onClose
ActionAction to run when dialog closed.Can be changed withOnClosefield.
Minimal code
// create popup instance
var popup = popupTemplate.Clone();
// show popup
popup.Show();
// specify root canvas if popup cloned from prefab
popup.Show(canvas: canvas);
Advanced
// create popup instance
var popup = popupTemplate.Clone();
// show popup with following parameters
popup.Show(
title: "Modal popup",
message: "Simple Modal popup.",
modal: true,
modalColor: new Color(0, 0, 0, 0.8f)
);
Async
var popup = popupTemplate.Clone();
await popup.ShowAsync();