This page describes the Dialogue System's custom property drawers and attributes, which you can use in your own custom editor scripts.
Use the [ConversationPopup]
attribute in your class definition to turn a string into a conversation popup. It has an optional Boolean parameter to show a database selection field.
Use the [QuestPopup]
attribute in your class definition to turn a string into a quest popup. It has an optional Boolean parameter to show a database selection field.
The [QuestState]
attribute changes the quest state popup to use lowercase letters so it matches the case used in Lua.
Use the [ItemPopup]
attribute in your class definition to turn a string into an item popup. It has an optional Boolean parameter to show a database selection field.
Use the [VariablePopup]
attribute in your class definition to turn a string into a variable popup. It has an optional Boolean parameter to show a database selection field.
Use the [LuaConditionWizard]
and [LuaScriptWizard]
attributes in your class definition to turn a string into a Lua wizard field. This allows you to assign Lua code to the string using the drop-down Lua wizards.
Internally, conversation titles and quest names are just strings. It's helpful to provide pop-up menus instead of having to manually enter the strings. The content for the pop-up menus come from the dialogue database assigned to the static property PixelCrushers.DialogueSystem.EditorTools.selectedDatabase
.
If EditorTools.selectedDatabase isn't set, it will default to the Dialogue Manager's Initial Database if you have a Dialogue Manager in your scene.
The ConversationPopup Attribute and QuestPopup Attribute let you specify whether to also show a field where the designer can select the database.
If you want to manually show the database selection field, use the following code in your custom editor:
To draw a dialogue trigger event (e.g., OnUse, OnTriggerEnter, etc.) in a custom inspector, call DialogueTriggerEventDrawer.LayoutPopup()
:
This method shows the choices in a nicer order than the default used by GUILayout.EnumPopup()
.
To manually incorporate Lua wizards in your custom editor scripts, create a Lua wizard and then call its Draw() method. (Note: It's usually easier to simply use the Lua Wizard Attributes above.)
Example: Say you have a MonoBehaviour like this:
Use this code to draw a wizard for the luaCode variable:
<< Script Messages | Integrating With Other Systems and Scripts >>