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

Text Asset#

Files / Text Asset

  • Can Read

  • Cannot Write

Description#

The contents of a Text Asset file

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]
    
    [Inline(nameof(m_File), typeof(TextAsset), false)]
    
    [Title("Text Asset")]
    [Category("Files/Text Asset")]
    
    [Description("The contents of a Text Asset file")]
    [Image(typeof(IconTextAsset), ColorTheme.Type.TextLight)]
    
    [Keywords("File", "Text", "Asset")]
    [Keywords("TXT", "CSV", "JSON", "XML", "YAML")]
    
    [Serializable]
    public class TypeStringTextAsset : TypeString
    {
        [SerializeField] private TextAsset m_File;

        public override string GetPreview(GameObject source) => this.m_File != null ? this.m_File.text : string.Empty;

        public TypeStringTextAsset() : this(null)
        { }
        
        public TypeStringTextAsset(TextAsset textAsset)
        {
            this.m_File = textAsset;
        }

        public override string Get(Args args)
        {
            return this.m_File != null ? this.m_File.text : string.Empty;
        }

        public override string ToString()
        {
            return this.m_File != null ? this.m_File.name : string.Empty;
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.