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

TMP Text Get Preferred Values#

UI / Graphic / TMP Text / TMP Text Get Preferred Values Text, Width, Height

Description#

Compares the Get Preferred Values method of TMP Text component to another value

Parameters#

Name Description
TMP Text
Text
Width
Height
Value

Code#

// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.UI;
using TMPro;

namespace VisualScript.Runtime
{
    [Title("TMP Text Get Preferred Values")]
    [Category("UI/Graphic/TMP Text/Get Preferred Values", "Text, Width, Height")]
    [Description("Compares the Get Preferred Values method of TMP Text component to another value")]
    
    [Image(typeof(IconUIText), ColorTheme.Type.Blue)]
    [Keywords("UI, User, Interface, TMP, Text, Mesh, Pro")]
    
    [Parameter("TMP Text")]
    [Parameter("Text")]
    [Parameter("Width")]
    [Parameter("Height")]
    [Parameter("Value")]
    
    [Serializable]
    public class GenConditionVector2_TMP_Text_CheckGetPreferredValues_3_StringText_FloatWidth_FloatHeight : Condition
    {
        [SerializeField] private GetGameObject m_TMP_Text = new GetGameObject(
            new GenTypeGameObject_TMP_Text()
        );
        
        [SerializeField] private GetVector2 m_Value = new GetVector2();
        
        [SerializeField] private GetString m_Text = new GetString();
        
        [SerializeField] private GetNumber m_Width = new GetNumber();
        
        [SerializeField] private GetNumber m_Height = new GetNumber();
        
        protected override string GetTitle(GameObject source)
        {
            string method = TextUtils.ThemeAsKeyword("Get Preferred Values");
            string parameters = $"({this.m_Text}, {this.m_Width}, {this.m_Height})";
            return $"{this.m_TMP_Text} {method} = {this.m_Value}";
        }
        
        protected override bool Run(Args args)
        {
            TMP_Text component = this.m_TMP_Text.Get<TMP_Text>(args);
            if (component == null) return false;
            
            Vector2 value = component.GetPreferredValues(
                (string) this.m_Text.Get(args),
                (float) this.m_Width.Get(args),
                (float) this.m_Height.Get(args)
            );
            
            return value == (Vector2) this.m_Value.Get(args);
        }
    }
}

Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.