---
tags:
    - "UI, User, Interface, Label"
---

# Text Max Width

[UI](../../index.md) / [Graphic](../index.md) / [Text](index.md) / **Text Max Width**

## Description

Compares the Max Width property of Text component to another value

## Parameters

| Name | Description |
| :--- | :---------- |
| Text |  |
| Compare |  |
| Value |  |

## Code

```cs
// <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;

namespace VisualScript.Runtime
{
    [Title("Text Max Width")]
    [Category("UI/Graphic/Text/Max Width")]
    [Description("Compares the Max Width property of Text component to another value")]

    [Image(typeof(IconUIText), ColorTheme.Type.TextLight)]
    [Keywords("UI, User, Interface, Label")]

    [Parameter("Text")]
    [Parameter("Compare")]
    [Parameter("Value")]

    [Serializable]
    public class GenConditionNumber_Text_CheckMaxWidth : Condition
    {
        [SerializeField] private GetGameObject m_Text = new GetGameObject(
            new GenTypeGameObject_Text()
        );

        [SerializeField] private CompareNumber m_Compare = new CompareNumber();

        [SerializeField] private GetNumber m_Value = new GetNumber();

        protected override string GetTitle(GameObject source)
        {
            string member = TextUtils.ThemeAsKeyword("Max Width");
            return $"{this.m_Text} {member} {this.m_Compare} {this.m_Value}";
        }

        protected override bool Run(Args args)
        {
            Text component = this.m_Text.Get<Text>(args);
            if (component == null) return false;

            return this.m_Compare.Compare(component.maxWidth, (float) this.m_Value.Get(args));
        }
    }
}
```

