Advertisement

设计和开发Unity Text动态滚动文字显示效果

阅读量:

在各类公告界面中,我们常常能够观察到文字以滚动形式呈现的跑马灯效果。

那么在Unity平台中该如何达成这一效果呢?

1、首先需要建立一个Text(或TextMeshPro)组件,并在其中填入希望展示的文字内容,具体操作示例如下:

请添加图片描述

2、创建用于控制的脚本文件TextRoll.cs:

复制代码
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class TextRoll : MonoBehaviour
    {
    public float scrollSpeed = 200f;
    private RectTransform textTransform;
    
    // Start is called before the first frame update
    void Start()
    {
        textTransform = GetComponent<RectTra

全部评论 (0)

还没有任何评论哟~