Forum rules - please read before posting.

Editing multiple conversations quickly

The conversation component does not allow for multi-component editing. The difficulty for me is I have 12ish conversations that all have the same dialogue options that all have the same image as well. When I want to add a new dialogue option, I need to individually add it to each conversation and set the image and action list, but other than the action list this is the same for all of them. I already have 42ish dialogue options and will likely have close to 100.

Is there a faster way to edit these? You can't seem to copy-paste any number of dialogue options out of a conversation component. Is there a script version of the conversation component where these dialogue options are being stored as you add them, where I could copy and paste into?

(P.S. to make matters worse, when I click a dialogue option to start editing it, it often closes itself immediately or closes itself when I click away to drag in the action list, and I'll have to go back and open it multiple times)

Comments

  • Unity doesn't allow componets to be edited together if they rely on custom editors, unless your Inspector is in Debug mode.

    If you present the player with the same options multiple times, however, you don't need to create a separate Conversation each time. Checking the Dialogue: Start conversation Action's Override options? option allows you to set the reaction for each option directly in the ActionList - ignoring any DialoguOption ActionLists previously set, and letting you run different Actions each time you use this Action.

    A tutorial that covers this workflow can be found here.

    it often closes itself immediately or closes itself when I click away to drag in the action list, and I'll have to go back and open it multiple times

    You can lock a GameObject at the top of the Inspector window to force it to remain visible even when another object is selected.

    1. Doing it all as one conversation sounds handy, but I have concerns about the conversation remembering which dialogue options have been selected. Assuming I have "Mark options already used" checked and all of my NPCs are sharing the same conversation, might speaking to one NPC end up checking off the question for all NPCs?

    1b. If all npcs will have 1-5 unique dialogue options (while all 99 others options a shared) and I am using one conversation instead of 12, will I be able to change not just the action list but also the image for these few, unique dialogue options? As well as these few options need to be enabled for only some NPCs and not others.

    1. A related question regarding "Mark options already used", is there any way to make the highlight apply to the image rather than the text? My dialogue options will be displayed as images only.

    2. Lastly, I didn't mean the inspector window would change, rather that the Conversations component itself has the "dialogue options" section under the "properties" section. When I click one of my dialogue options, it will often flash open then closed and I'll need to select it again to view the Dialogue option 'blank' properties.

    Thanks!

  • Doing it all as one conversation sounds handy, but I have concerns about the conversation remembering which dialogue options have been selected. Assuming I have "Mark options already used" checked and all of my NPCs are sharing the same conversation, might speaking to one NPC end up checking off the question for all NPCs?

    Yes - the data related to options is part of the Conversation, not the Action that runs it.

    It's possible to clear this data through scripting - if your NPC conversations were sequential (i.e. you didn't return to NPC A after speaking with NPC B), you could just clear the data in between.

    Otherwise, you'll need to use separate Conversations so that the data is unique for each NPC.

    It's still possible to make this easier with scripting, however. Here's a sample script that will auto-add new dialogue options to a Conversation using an array of icons. To use it, paste into a C# script named AutoAddConversationIcons.cs, add to the scene, fill in its Inspector, and click "Populate" in the Inspector's cog menu:

    using UnityEngine;
    using AC;
    
    public class AutoAddConversationIcons : MonoBehaviour
    {
    
        public Conversation conversation;
        public Texture2D[] icons;
    
        [ContextMenu ("Populate")]
        public void Populate ()
        {
            foreach (Texture2D icon in icons)
            {
                ButtonDialog newOption = new ButtonDialog (conversation.GetIDArray ());
                newOption.icon = icon;
                conversation.options.Add (newOption);
            }
            #if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty (conversation);
            #endif
        }
    }
    

    If all npcs will have 1-5 unique dialogue options (while all 99 others options a shared) and I am using one conversation instead of 12, will I be able to change not just the action list but also the image for these few, unique dialogue options? As well as these few options need to be enabled for only some NPCs and not others.

    If you were able to go with the "single Conversation" method, you can add all the unique options for each NPC, and then hide/show them as needed before it runs for a given NPC.

    A related question regarding "Mark options already used", is there any way to make the highlight apply to the image rather than the text? My dialogue options will be displayed as images only.

    If you're using Unity UI, the colours set in the DialogList menu element will be used to affect the associated Button component's Transition colour block. What gets re-coloured is determined by the Button's "Target" field. Assigning the Image here will re-colour the icon instead.

    If you want to change the icon itself, that's possible but will require custom scripting.

    Lastly, I didn't mean the inspector window would change, rather that the Conversations component itself has the "dialogue options" section under the "properties" section. When I click one of my dialogue options, it will often flash open then closed and I'll need to select it again to view the Dialogue option 'blank' properties.

    Apologies, but I'm afraid I don't follow. If you can share a gif/video showing the behaviour, that'll help clarify.

  • edited March 21

    Here is an example of the closing issue, you can see when I click on the dialogue option it often opens and then immediately closes, as well as closing while making changes to it.

    The scripting method sounds ideal! I've started tinkering with the script, but am having trouble getting the icon set. I tried out the script and it creates the dialogue option and everything, but the image remains empty. I tried printing the icon name to verify it was set correctly before the Add() is called, and the name is properly printed. Other than icon, properties are being set correctly. Here is what I have currently:

    `
    public class AutoAddConversationIconsEditorTool : MonoBehaviour
    {
    public Conversation conversation;
    public Texture2D[] icons;
    public string testName;
    public ActionListAsset actionList;

        [ContextMenu("Populate")]
        public void Populate()
        {
            foreach (Texture2D icon in icons)
            {
                ButtonDialog newOption = new ButtonDialog(conversation.GetIDArray())
                {
                    label = testName,
                    icon = icon,
                    assetFile = actionList,
                    isOn = false
                };
                print(newOption.icon.name);
                conversation.options.Add(newOption);
            }
        #if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(conversation);
        #endif
        }
    }
    

    `

    P.S. Is there a way to do something similar to mass edit conversation dialogue options as well? I see conversation.options.Add() and Delete(), but not Update().

    Thanks!

  • Here is an example of the closing issue, you can see when I click on the dialogue option it often opens and then immediately closes, as well as closing while making changes to it.

    Thanks. What platform/OS are you working on? I suspect this is an issue with the drag-and-drop feature, which can be troublesome in some systems. For this reason, it's made optional - and can be disabled in the Adventure Creator section of your Project settings.

    Does disabling Drag-drop list re-ordering? prevent the issue?

    Other than icon, properties are being set correctly.

    My mistake. icon has since been deprecated, to allow for animated icons. Use this instead:

    using UnityEngine;
    using AC;
    
    public class AutoAddConversationIconsEditorTool : MonoBehaviour
    {
        public Conversation conversation;
        public Texture2D[] icons;
        public string testName;
        public ActionListAsset actionList;
    
        [ContextMenu("Populate")]
        public void Populate()
        {
            foreach (Texture2D icon in icons)
            {
                ButtonDialog newOption = new ButtonDialog(conversation.GetIDArray())
                {
                    label = testName,
                    cursorIcon = new CursorIconBase () { texture = icon },
                    assetFile = actionList,
                    isOn = false
                };
                conversation.options.Add(newOption);
            }
            #if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(conversation);
            #endif
        }
    }
    

    Is there a way to do something similar to mass edit conversation dialogue options as well? I see conversation.options.Add() and Delete(), but not Update().

    You can iterate through the options List to make changes, i.e.:

    forech (var option in conversation.options)
    {
        // Edit 'option' here
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.