DialogManager_ConvList

See - Conversation ScriptableObjects

Required: Import: ScriptableObject Factory Package

Basic DialogPrefab

Reminder, this uses the same configuration of the SimpleDialogPrefab for the version that doesn't use SpeakerImage. Remember to add the DialogText as the first child of the DialogPanel.

Using the Same Prefab as SimpleDialog

DialogPrefab with Image

You have a choice of using the Simple DialogPrefab for your project, which does not include a UI image with a sprite to allow display of an image of each conversation entry's speaker. Otherwise, follow steps to create DialogPrefab wImg on the subsequent page.

NextPanelToOpen

The DialogManager script has a public reference variable that can be set in the Inspector allows for the nextPanelToOpen to be populated. After all of the dialog entries has been displayed, the dialogPanel is closed, and then the nextPanelToOpen will be opened. If not populated, no error will occur because the code first checks to see if that variable contains a valid object reference (memory address).

Add the linked script to the DecisionPanel so it will stay closed at the start of the scene, if desired Hide_Show_Panel Script

Coroutines

See Next Page Coroutines: We'll use a Unity Coroutine to create Dynamic typing text.

See Unity Manual

A coroutine is like a function that has the ability to pause execution and return control to Unity but then to continue where it left off on the following frame.

OpenDialogBtn

The OpenDialogBtn public obj-reference variable in the Inspector should be populated if a button will be used to open the dialog. Otherwise, the ShowOnStart checkbox in the Inspector should be selected, it will make the panel visible at the beginning of the scene.

For example, set OpenDialogBtn to a StartDialog Button

Includes public CanvasGroup nextPanelToOpen;

Select ScriptableObject Instance in Inspector

The image below shows that the public ConversationList variable: convList has been set in the inspector by selecting the circle-icon to the right of the ConvList item

See Attached Conversation ScriptableObject: ConvList

DialogManager.cs

Below is the full code for the DialogManager.cs. You can paste this code into a script in your project.

Last updated

Was this helpful?