# Edit OptionPanel

This page provides configuration details for UI Panel GameObjects: OptionPanel, TitlePanel, used with Dialog Prefabs.

For any UI-Panel that you'd like to show/hide, you must add a CanvasGroup, and the Hide\_Show\_Panel.cs script as shown in the image below.

The Hide\_Show\_Panel.cs script component's public fields: **ShowOnStart, CloseButton, OpenButton** will be configured according to desired behavior for each situation. The examples below show a few possible configurations.

## Hide\_Show\_Panel, CanvasGroup

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M0-KOTdBSCNJjpmpwrG%2F-M0-KjHcQgulBqUGkCp1%2FScreen%20Shot%202019-03-06%20at%203.25.54%20PM.png?generation=1581627422968009\&alt=media) \
Example Configuration for OptionPanel&#x20;

## OptionPanel - Prefab

[Link to Detailed Instructions to create OptionPanel ](https://kdoore.gitbook.io/cs2335/project-2-statemanager/optionpanel-prefab) \
OptionPanel prefab is a UI panel that contains 2 buttons that can be used for scene change logic in all scenes. Now that we're adding dialog to the scenes, the OptionPanel can initially be hidden when the scene is loaded. Then it's opened by the OptionPanel's script, when there's no dialog left to display. It is configured as the "NextPanelToOpen" for the SimpleDialog and DialogManager scripts.

**OptionPanel:**&#x54;his is a UI-Panel with 2 child-objects that are UI-Buttons.

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-MIQ__sTj_htxLjABZnq%2F-MIQfe6hcrPehAzDHyZH%2FScreen%20Shot%202020-09-29%20at%204.04.15%20PM.png?alt=media\&token=eebed133-4542-4189-99d7-1a6858e33210)

### **Edit OptionPanel**

**Open OptionPanel Prefab to Edit:**\
**Attach CanvasGroup** \
**Attach Hide\_Show\_Panel.cs**

* Configuration for **Hide\_Show\_Panel.cs on OptionPanel:**&#x20;
  * ShowOnStart - default: hidden, determines if the dialog is visible at start of scene
  * CloseButton: (not populated)
  * OpenButton: (not populated)

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M0-KOTdBSCNJjpmpwrG%2F-M0-KjHcQgulBqUGkCp1%2FScreen%20Shot%202019-03-06%20at%203.25.54%20PM.png?generation=1581627422968009\&alt=media) \
Example Configuration for OptionPanel&#x20;

The image below shows the hierarchy panel for a TitlePanel that has a UI text, and a UI-Button that can be used to open a dialog prefab.

It is optional to use a TitlePanel, but it provides a simple way to provide game instructions in

## TitlePanel - Prefab (Optional)

![](https://3353821304-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0-KLgOacVpbicrqehO%2F-M0-KOTdBSCNJjpmpwrG%2F-M0-KjHeDEsC0MDX_Sgh%2FScreen%20Shot%202019-03-06%20at%202.26.55%20PM.png?generation=1581627422644172\&alt=media)

**TitlePanel:** This is a UI-Panel with children:

* **Children:**
* UI-Text: TitleText
* UI\_Button: StartDialogBtn
* **Attach CanavasGroup**&#x20;
* **Attach Hide\_Show\_Panel.cs** The Hide\_Show\_Panel script will make sure the panel shows at start, and is hidden when the StartDialogBtn is clicked.
* Configuration for **Hide\_Show\_Panel.cs on TitlePanel:**&#x20;
* ShowOnStart checked as True
* CloseButton: StartDialogBtn
* OpenButton: empty
