FANDOM


This script causes a Conversation's previously-chosen dialog options to become skippable.

For it to work, you must rely on separate DialogOption ActionLists for each option, as opposed to checking Override options? in the Dialogue: Start conversation Action.

To use it, paste the code below into a C# file named DynamicSkipConv, and attach it to a GameObject in your scene.

using UnityEngine;
using System.Collections;
using AC;

public class DynamicSkipConv : MonoBehaviour
{

    private void OnEnable ()
    {
        EventManager.OnStartConversation += OnStartConversation;
    }

    private void OnDisable ()
    {
        EventManager.OnStartConversation -= OnStartConversation;
    }

    private void OnStartConversation (Conversation conversation)
    {
        foreach (ButtonDialog option in conversation.options)
        {
            if (option.assetFile != null)
            {
                option.assetFile.isSkippable = option.hasBeenChosen;
            }
            else if (option.dialogueOption != null)
            {
                option.dialogueOption.isSkippable = option.hasBeenChosen;
            }
        }
    }

}
Community content is available under CC-BY-SA unless otherwise noted.