Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Game Creator 3 logo Dialogue

Pick Script Choice#

Game Creator / Dialogue / Pick Script Choice

Description#

Instructs the chosen Dialogue to pick a choice

Note

The index is 0-based, meaning the first choice is 0, the second is 1, and so on

Note

The 'Script Order' uses the index as it appears in the Script

Note

The 'Shuffled Order' uses the index as it appears in the UI after (potentially) shuffling the choices

Parameters#

Name Description
Dialogue The Dialogue playing the script
Index The choice index from all the available ones
Mode Whether the index is as choices appear in the Script or after shuffling them

Code#

using System;
using UnityEngine;
using VisualScript.Icons;
using VisualScript.Runtime;

namespace GameCreator.Runtime.Dialogue
{
    [Title("Pick Script Choice")]
    [Image(typeof(IconChoiceSolid), ColorTheme.Type.TextLight)]

    [Description("Instructs the chosen Dialogue to pick a choice")]
    [Category("Game Creator/Dialogue/Pick Choice")]

    [Parameter("Dialogue", "The Dialogue playing the script")]
    [Parameter("Index", "The choice index from all the available ones")]
    [Parameter("Mode", "Whether the index is as choices appear in the Script or after shuffling them")]

    [Keywords("Dialogue", "Next", "Line", "Text", "Script", "Narration", "Continue")]

    [Note("The index is 0-based, meaning the first choice is 0, the second is 1, and so on")]
    [Note("The 'Script Order' uses the index as it appears in the Script")]
    [Note("The 'Shuffled Order' uses the index as it appears in the UI after (potentially) shuffling the choices")]

    [Serializable]
    public class InstructionDialogueScriptChoice : Instruction
    {
        [SerializeField] private GetGameObject m_Dialogue = new GetGameObject(
            new TypeGameObjectDialogue()
        );

        [SerializeField] private GetInteger m_Index = new GetInteger(0);
        [SerializeField] private ChoiceMode m_Mode = ChoiceMode.ShuffledOrder;

        protected override string GetTitle(GameObject source) => $"{this.m_Dialogue} Choose {this.m_Index}";

        protected override Awaitable Run(Args args)
        {
            Dialogue dialogue = this.m_Dialogue.Get<Dialogue>(args);
            int index = this.m_Index.GetInt(args);

            if (dialogue != null) dialogue.PickChoice(index, this.m_Mode);
            return Done;
        }
    }
}
Game Creator 3 logoGame Creator 3 © Catsoft Works 2026. All rights reserved.