Unity Assets‎ > ‎Common Dialogs‎ > ‎

How-To



How do I customize the dialogs?

The dialogs are set up as prefabs.  The DialogManager has references to the prefabs that it uses to instantiate the dialogs.  Either edit the dialog's prefab directly or make a copy of the prefab and change DialogManager to use your new prefab. 

Another option to instantiate the prefab into your scene and modify that instance directly.  You will need some mechanism to find your dialog such as reference in another object or using the Unity Find object methods.  Remember to also clear the "DestroyOnClose" flags for dialogs you want to reuse.


How do I keep the dialogs from self-destructing?

There is a setting on the dialog base class for automatically Destroying the dialog on close called DestroyOnClose.  The dialogs created by DialogManager are preset to auto-destroy.  If you want to reuse your dialog, disable this flag.


How do I control the show/hide animation?

DialogBase has some very simple code for hiding and showing the dialog's window and blocking panel.  Modify this code to something more interesting such as fading the color of the blocking panel from (0, 0, 0, 0) to (0, 0, 0, 128) using DOTween or iTween or some other tweening library.


How do I control the blocking panel and what is it?

The blocking panel is used to make the screen behind the dialog less intrusive while the dialog is active and to block mouse clicks.  The panel doesn't have to be visible to function but it does need to catch ray casts to prevent users clicking on things behind the active dialog.  Each dialog has its own blocking panel in case you want to layer several open dialogs.  For example, if you have a File Dialog open and want to pop an error message you would need a blocking panel to prevent input to the File Dialog until the user clicks the "Ok" button.


What sort of dialogs are supported at this time?

* File Dialog - gets a file name from the user for saving and loading.  It can also operate in a "path" mode for retrieving a path for your own usage such as were to auto-save or load data from.

* Input Dialog - simple dialog for getting a value from the user.  This value can be a string, number, or a drop down list choice.  There are also username, password, and email string types.

* Login Dialog - simple dialog for username and password.

* Message Dialog - simple dialog for displaying an icon, string, and optional buttons to the user.  If you want to display a confirmation dialog such as "Do you want to exit? Yes | No", this is the dialog you would want to use.  The callback function will provide the button that was clicked by the user.

* Progress Dialog - used for displaying a progress bar to the user.  The progress can be set duration such as when you know how many steps are left to complete or indeterminate when you don't know how long the operation will take.

* Popup Menu - simple list of buttons used for popup context menus.

* Notification Message - message box that pops up and disappears after a set time.



What other nifty utility classes are in the library?


* Drag Panel - used for allowing the user to drag your dialog window around

* Resize Panel - used for allowing the user to resize your dialog window

* MenuBar - for displaying a menu similar to Mac or Windows menus

* ToolBar - for displaying mini buttons similar to Mac or Windows toolbars

* StatusBar - for displaying a text message or other status information commonly displayed at the bottom of a dialog

* TitleBar - for displaying a title text message, dialog close button, and optional min/max resize buttons.  The title bar is also draggable by default.