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

Concatenate#

Operations / Composing / Concatenate

  • Can Read

  • Cannot Write

Description#

Appends the second text at the end of the first one, with an optional separator

Parameters#

Name Description
Text 1 The text placed at the beginning
Text 2 The text appended at the end
Separator The text placed between both values. Empty by default

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Concatenate")]
    [Category("Operations/Composing/Concatenate")]

    [Description("Appends the second text at the end of the first one, with an optional separator")]
    [Image(typeof(IconString), ColorTheme.Type.Yellow, typeof(BadgePlus))]

    [Parameter("Text 1", "The text placed at the beginning")]
    [Parameter("Text 2", "The text appended at the end")]
    [Parameter("Separator", "The text placed between both values. Empty by default")]

    [Keywords("Add", "Append", "Combine", "Merge", "Plus", "Sum", "Text")]

    [Serializable]
    public class TypeStringConcatenate : TypeString
    {
        [SerializeField] private GetString m_Text1 = new GetString();
        [SerializeField] private GetString m_Text2 = new GetString();
        [SerializeField] private GetString m_Separator = new GetString(string.Empty);

        public override string GetPreview(GameObject source) => Concatenate(
            this.m_Text1.GetPreview(source),
            this.m_Text2.GetPreview(source),
            this.m_Separator.GetPreview(source)
        );

        public override string Get(Args args) => Concatenate(
            this.m_Text1.Get(args),
            this.m_Text2.Get(args),
            this.m_Separator.Get(args)
        );

        private static string Concatenate(string text1, string text2, string separator)
        {
            return string.Concat(text1 ?? string.Empty, separator ?? string.Empty, text2 ?? string.Empty);
        }

        public override string ToString()
        {
            return $"{this.m_Text1} + {this.m_Text2}";
        }

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