Popups can be easily created and displayed with the help of the UI Assistant’s Popup Manager by setting up Popup Contexts.
The Popup Manager is a singleton component designed to manage popups across your project, with the help of Popup Contexts. It must be attached to a prefab to ensure proper behavior, and at least one instance must be placed in a scene, preferably the first scene that appears when launching your project.
The Text Mesh Pro UGUI that will display the Popup Context's header text.
The Text Mesh Pro UGUI that will display the Popup Context's body text.
Template that will be instantiated to create the Popup Context's buttons.
A Text Mesh Pro UGUI child of the template button that serves as its label.
Unity Events to be invoked when the popup window is shown.
Unity Events to be invoked when the popup window is closed.
Shows the popup window with context-based parameters.
Popup Contexts allow you to set up popup parameters anywhere in your project. These parameters include a header text to clarify the popup’s purpose with a few keywords, a body text that serves as a call to action or an informative description, and one or several buttons with functions.
Note that this setup does not require you to work with any Button or Text Mesh Pro UGUI, as that is handled automatically by the Popup Manager during runtime.
When set to true, Popup Manager will be notified when the Popup Context is enabled.
When set to true, buttons' labels will require Localization Sets instead of strings.
Text to be displayed at the top of the popup window.
Text that serves as the main content of the popup window.
One or multiple buttons with on-click functions.
Text to be displayed on the button.
Unity Events to be invoked when the button is clicked.
Notifies the Popup Manager to show a popup with this Popup Context's parameters.
For Popup Contexts to work, your scene must have a Popup Manager. Otherwise, you will receive a "Popup Context failed to trigger popup; please add a Popup Manager to your scene." warning. The Samples/Prefabs folder contains a “PopupManager” prefab, ready to be used.