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

Id#

Ids / Id

  • Can Read

  • Cannot Write

Description#

A constant id, which only keeps letters, digits, dashes and underscores

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Inline(nameof(m_Id))]

    [Title("Id")]
    [Category("Ids/Id")]

    [Description("A constant id, which only keeps letters, digits, dashes and underscores")]
    [Image(typeof(IconID), ColorTheme.Type.Yellow)]

    [Keywords("String", "Text", "Name", "Key", "Mount", "Muzzle", "Sight", "Grip", "Slot")]

    [Serializable]
    public class TypeStringId : TypeString, ISerializationCallbackReceiver
    {
        [SerializeField] private string m_Id;

        // CONSTRUCTORS: --------------------------------------------------------------------------

        public TypeStringId() : this(string.Empty)
        { }

        public TypeStringId(string id)
        {
            this.m_Id = TextUtils.MakeId(id);
        }

        // PUBLIC METHODS: ------------------------------------------------------------------------

        public override string GetPreview(GameObject source) => this.m_Id;

        public override string Get(Args args) => this.m_Id;

        public override string ToString() => this.m_Id;

        // SERIALIZATION: -------------------------------------------------------------------------

        void ISerializationCallbackReceiver.OnBeforeSerialize()
        {
            this.m_Id = TextUtils.MakeId(this.m_Id);
        }

        void ISerializationCallbackReceiver.OnAfterDeserialize()
        { }

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