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.
Visual Script logo Manual

Bool#

Bool / Bool

  • Can Read

  • Cannot Write

Description#

The text that represents each of the two states of a boolean value

Parameters#

Name Description
Bool The boolean value converted to text
If True The text returned when the value is True
If False The text returned when the value is False

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Bool")]
    [Category("Bool/Bool")]

    [Description("The text that represents each of the two states of a boolean value")]
    [Image(typeof(IconToggleOn), ColorTheme.Type.Blue)]

    [Parameter("Bool", "The boolean value converted to text")]
    [Parameter("If True", "The text returned when the value is True")]
    [Parameter("If False", "The text returned when the value is False")]

    [Keywords("Boolean", "True", "False", "Toggle", "Text", "Convert")]

    [Serializable]
    public class TypeStringBoolGet : TypeString
    {
        [SerializeField] private GetBool m_Bool = new GetBool();
        [SerializeField] private GetString m_IfTrue = new GetString("True");
        [SerializeField] private GetString m_IfFalse = new GetString("False");

        public override string GetPreview(GameObject source)
        {
            return this.m_Bool.GetPreview(source)
                ? this.m_IfTrue.GetPreview(source)
                : this.m_IfFalse.GetPreview(source);
        }

        public override string Get(Args args)
        {
            return this.m_Bool.Get(args)
                ? this.m_IfTrue.Get(args)
                : this.m_IfFalse.Get(args);
        }

        public override string ToString()
        {
            return this.m_Bool.ToString();
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.