Popup
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
DialogInfoBase
Component to display the popup info.
AutoFocus
bool
Set focus to the last Selectable object in the Popup.
CloseButton
Button
Button to close popup.
Hide on Modal Click
bool
Close popup on click on the background if the
modal
option enabled.
Show() Method Parameters
All parameters are optional.
title
and message
also can be specified with SetInfo()
to use formatted strings.title
string
Popup title.Can be changed withSetInfo()
method.message
string
Popup message.Can be changed withSetInfo()
method.position
Vector3?
Popup position.Can be changed withSetPosition()
.icon
Sprite
Popup icon.Can be changed withSetInfo()
method.modal
bool
Modal popup.Can be changed withSetModal()
.modalSprite
Sprite
Background image for the modal popup.Can be changed withSetModal()
.modalColor
Color?
Background color for the modal popup.Can be changed withSetModal()
.canvas
Canvas
Canvas to display popup. Required if popup template is prefab.Can be changed withSetCanvas()
.content
RectTransform
Dialog content. Can be used instead of the message and icon.Can be changed withSetContent()
.onClose
Action
Action to run when dialog closed.Can be changed withOnClose
field.
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();