当前位置:网站首页>【Unity】插件TextAnimator 新手使用说明

【Unity】插件TextAnimator 新手使用说明

2022-06-23 16:53:00 C#李哪托#C

新手购买玩TextAnimator不知道如何上手,使用文档不知道从何处看起(没错就是我),简单介绍一下该如何使用,不是太严谨的使用说明,如有问题欢迎指正。

1.添加组件
TMP Text文件添加组件
添加了TextAnimatorPlayer会自动帮你添加TextAnimator
在这里插入图片描述
2.
添加相应的标签到富文本中

在这里插入图片描述

在这里插入图片描述
3. 通过代码控制其显示和关闭

    /// <summary>
    /// 显示文本
    /// </summary>
    /// <param name="_text">_text</param>
    public static void ShowText(TMP_Text _text)
    {
        if (_text.GetComponent<TextAnimatorPlayer>() !=null)
        {
            TextAnimatorPlayer textAnimatorPlayer = _text.GetComponent<TextAnimatorPlayer>();
            textAnimatorPlayer.StartShowingText(true);
        }
        else
        {
            Debug.LogError("TextAnimatorPlayer is NULL");
        }
    }
    /// <summary>
    /// 文本消失
    /// </summary>
    /// <param name="_text"></param>
    public static void DisappearingText(TMP_Text _text)
    {
        if (_text.GetComponent<TextAnimatorPlayer>() != null)
        {
            TextAnimatorPlayer textAnimatorPlayer = _text.GetComponent<TextAnimatorPlayer>();
            textAnimatorPlayer.StartDisappearingText();
        }
        else
        {
            Debug.LogError("TextAnimatorPlayer is NULL");
        }
    }

这样就可以控制它的显示和关闭了,剩下的API文档都写的有,可以自己去查

原网站

版权声明
本文为[C#李哪托#C]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_46030212/article/details/125428733