A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.UI.Text.html below:

Class Text Inherited Members

Component.GetComponentIndex()

Object.InstantiateAsync<T>(T)

Object.InstantiateAsync<T>(T, Transform)

Object.InstantiateAsync<T>(T, Vector3, Quaternion)

Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)

Object.InstantiateAsync<T>(T, InstantiateParameters)

Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters)

Object.Instantiate(Object, Scene)

Object.Instantiate<T>(T, InstantiateParameters)

Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)

Object.FindObjectsByType<T>(FindObjectsSortMode)

Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)

Object.FindFirstObjectByType<T>()

Object.FindAnyObjectByType<T>()

Object.FindFirstObjectByType<T>(FindObjectsInactive)

Object.FindAnyObjectByType<T>(FindObjectsInactive)

Namespace: UnityEngine.UI Assembly: UnityEngine.UI.dll Syntax
[RequireComponent(typeof(CanvasRenderer))]
[AddComponentMenu("UI/Legacy/Text", 100)]
public class Text : MaskableGraphic, ICanvasElement, IClippable, IMaskable, IMaterialModifier, ILayoutElement
Constructors Text() Declaration Fields m_DisableFontTextureRebuiltCallback Declaration
[NonSerialized]
protected bool m_DisableFontTextureRebuiltCallback
Field Value m_Text Declaration
[TextArea(3, 10)]
[SerializeField]
protected string m_Text
Field Value s_DefaultText Declaration
protected static Material s_DefaultText
Field Value Properties alignByGeometry

Use the extents of glyph geometry to perform horizontal alignment rather than glyph metrics.

Declaration
public bool alignByGeometry { get; set; }
Property Value alignment

The positioning of the text reliative to its [[RectTransform]].

Declaration
public TextAnchor alignment { get; set; }
Property Value Examples
//Create a Text GameObject by going to __Create__>__UI__>__Text__. Attach this script to the GameObject to see it working.

using UnityEngine;
using UnityEngine.UI;

public class UITextAlignment : MonoBehaviour
{
    Text m_Text;

    void Start()
    {
        //Fetch the Text Component
        m_Text = GetComponent<Text>();
        //Switch the Text alignment to the middle
        m_Text.alignment = TextAnchor.MiddleCenter;
    }

//This is a legacy function used for an instant demonstration. See the <a href="https://unity3d.com/learn/tutorials/s/user-interface-ui">UI Tutorials pages </a> and [[wiki:UISystem|UI Section]] of the manual for more information on creating your own buttons etc.
    void OnGUI()
    {
        //Press this Button to change the Text alignment to the lower right
        if (GUI.Button(new Rect(0, 0, 100, 40), "Lower Right"))
        {
            m_Text.alignment = TextAnchor.LowerRight;
        }

        //Press this Button to change the Text alignment to the upper left
        if (GUI.Button(new Rect(150, 0, 100, 40), "Upper Left"))
        {
            m_Text.alignment = TextAnchor.UpperLeft;
        }
    }
}
cachedTextGenerator

The cached TextGenerator used when generating visible Text.

Declaration
public TextGenerator cachedTextGenerator { get; }
Property Value cachedTextGeneratorForLayout

The cached TextGenerator used when determine Layout

Declaration
public TextGenerator cachedTextGeneratorForLayout { get; }
Property Value flexibleHeight

The extra relative height this layout element should be allocated if there is additional available space.

Declaration
public virtual float flexibleHeight { get; }
Property Value Examples
  using UnityEngine;
                        using System.Collections;
                        using UnityEngine.UI; // Required when using UI elements.

                        public class ExampleClass : MonoBehaviour
                        {
                            public Transform MyContentPanel;

                            //Sets the flexible height on on all children in the content panel.
                            public void Start()
                            {
                                //Assign all the children of the content panel to an array.
                                LayoutElement[] myLayoutElements = MyContentPanel.GetComponentsInChildren<LayoutElement>();

                                //For each child in the array change its LayoutElement's flexible height to 100.
                                foreach (LayoutElement element in myLayoutElements)
                                {
                                    element.flexibleHeight = 100f;
                                }
                            }
                        }
flexibleWidth

The extra relative width this layout element should be allocated if there is additional available space.

Declaration
public virtual float flexibleWidth { get; }
Property Value Examples
  using UnityEngine;
                        using System.Collections;
                        using UnityEngine.UI; // Required when using UI elements.

                        public class ExampleClass : MonoBehaviour
                        {
                            public Transform MyContentPanel;

                            //Sets the flexible height on on all children in the content panel.
                            public void Start()
                            {
                                //Assign all the children of the content panel to an array.
                                LayoutElement[] myLayoutElements = MyContentPanel.GetComponentsInChildren<LayoutElement>();

                                //For each child in the array change its LayoutElement's flexible width to 200.
                                foreach (LayoutElement element in myLayoutElements)
                                {
                                    element.flexibleWidth = 200f;
                                }
                            }
                        }
font

The Font used by the text.

Declaration
public Font font { get; set; }
Property Value Examples
//Create a new Text GameObject by going to Create>UI>Text in the Editor. Attach this script to the Text GameObject. Then, choose or click and drag your own font into the Font section in the Inspector window.

using UnityEngine;
using UnityEngine.UI;

public class TextFontExample : MonoBehaviour
{
    Text m_Text;
    //Attach your own Font in the Inspector
    public Font m_Font;

    void Start()
    {
        //Fetch the Text component from the GameObject
        m_Text = GetComponent<Text>();
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.Space))
        {
            //Change the Text Font to the Font attached in the Inspector
            m_Text.font = m_Font;
            //Change the Text to the message below
            m_Text.text = "My Font Changed!";
        }
    }
}
fontSize

The size that the Font should render at. Unit of measure is Points.

Declaration
public int fontSize { get; set; }
Property Value Examples
//For this script to work, create a new Text GameObject by going to Create>U>Text. Attach the script to the Text GameObject. Make sure the GameObject has a RectTransform component.

using UnityEngine;
using UnityEngine.UI;

public class Example : MonoBehaviour
{
    Text m_Text;
    RectTransform m_RectTransform;

    void Start()
    {
        //Fetch the Text and RectTransform components from the GameObject
        m_Text = GetComponent<Text>();
        m_RectTransform = GetComponent<RectTransform>();
    }

    void Update()
    {
        //Press the space key to change the Font size
        if (Input.GetKey(KeyCode.Space))
        {
            changeFontSize();
        }
    }

    void changeFontSize()
    {
        //Change the Font Size to 16
        m_Text.fontSize = 30;

        //Change the RectTransform size to allow larger fonts and sentences
        m_RectTransform.sizeDelta = new Vector2(m_Text.fontSize * 10, 100);

        //Change the m_Text text to the message below
        m_Text.text = "I changed my Font size!";
    }
}
fontStyle

Font style used by the Text's text.

Declaration
public FontStyle fontStyle { get; set; }
Property Value horizontalOverflow

Horizontal overflow mode.

Declaration
public HorizontalWrapMode horizontalOverflow { get; set; }
Property Value layoutPriority

The layout priority of this component.

Declaration
public virtual int layoutPriority { get; }
Property Value lineSpacing

Line spacing, specified as a factor of font line height. A value of 1 will produce normal line spacing.

Declaration
public float lineSpacing { get; set; }
Property Value mainTexture

Text's texture comes from the font.

Declaration
public override Texture mainTexture { get; }
Property Value Overrides minHeight

The minimum height this layout element may be allocated.

Declaration
public virtual float minHeight { get; }
Property Value minWidth

The minimum width this layout element may be allocated.

Declaration
public virtual float minWidth { get; }
Property Value pixelsPerUnit

Provides information about how fonts are scale to the screen.

Declaration
public float pixelsPerUnit { get; }
Property Value preferredHeight

The preferred height this layout element should be allocated if there is sufficient space.

Declaration
public virtual float preferredHeight { get; }
Property Value preferredWidth

The preferred width this layout element should be allocated if there is sufficient space.

Declaration
public virtual float preferredWidth { get; }
Property Value resizeTextForBestFit

Should the text be allowed to auto resized.

Declaration
public bool resizeTextForBestFit { get; set; }
Property Value resizeTextMaxSize

The maximum size the text is allowed to be. 1 = infinitely large.

Declaration
public int resizeTextMaxSize { get; set; }
Property Value resizeTextMinSize

The minimum size the text is allowed to be.

Declaration
public int resizeTextMinSize { get; set; }
Property Value supportRichText

Whether this Text will support rich text.

Declaration
public bool supportRichText { get; set; }
Property Value text

Text that's being displayed by the Text.

Declaration
public virtual string text { get; set; }
Property Value Examples
using UnityEngine;
using UnityEngine.UI;

public class Example : MonoBehaviour
{
    public Text m_MyText;

    void Start()
    {
        //Text sets your text to say this message
        m_MyText.text = "This is my text";
    }

    void Update()
    {
        //Press the space key to change the Text message
        if (Input.GetKey(KeyCode.Space))
        {
            m_MyText.text = "My text has now changed.";
        }
    }
}
verticalOverflow

Vertical overflow mode.

Declaration
public VerticalWrapMode verticalOverflow { get; set; }
Property Value Methods CalculateLayoutInputHorizontal()

After this method is invoked, layout horizontal input properties should return up-to-date values. Children will already have up-to-date layout horizontal inputs when this methods is called.

Declaration
public virtual void CalculateLayoutInputHorizontal()
CalculateLayoutInputVertical()

After this method is invoked, layout vertical input properties should return up-to-date values. Children will already have up-to-date layout vertical inputs when this methods is called.

Declaration
public virtual void CalculateLayoutInputVertical()
FontTextureChanged()

Called by the FontUpdateTracker when the texture associated with a font is modified.

Declaration
public void FontTextureChanged()
GetGenerationSettings(Vector2)

Convenience function to populate the generation setting for the text.

Declaration
public TextGenerationSettings GetGenerationSettings(Vector2 extents)
Parameters Type Name Description Vector2 extents

The extents the text can draw in.

Returns GetTextAnchorPivot(TextAnchor)

Convenience function to determine the vector offset of the anchor.

Declaration
public static Vector2 GetTextAnchorPivot(TextAnchor anchor)
Parameters Returns OnDisable()

Clear references.

Declaration
protected override void OnDisable()
Overrides OnEnable()

Mark the Graphic and the canvas as having been changed.

Declaration
protected override void OnEnable()
Overrides OnPopulateMesh(VertexHelper)

Callback function when a UI element needs to generate vertices. Fills the vertex buffer data.

Declaration
protected override void OnPopulateMesh(VertexHelper toFill)
Parameters Overrides OnRebuildRequested()

Editor-only callback that is issued by Unity if a rebuild of the Graphic is required. Currently sent when an asset is reimported.

Declaration
public override void OnRebuildRequested()
Overrides OnValidate() Declaration
protected override void OnValidate()
Overrides Reset() Declaration
protected override void Reset()
Overrides UpdateGeometry()

Call to update the geometry of the Graphic onto the CanvasRenderer.

Declaration
protected override void UpdateGeometry()
Overrides Implements

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4