Меня интересует циклическое переключение текста, чтобы я мог отображать другой текст в своей 2D-игре.
Я попробовал скрипт на этом сайте. Но я не думаю, что это работает. Может я что-то не так делаю?
Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class CyclingText : MonoBehaviour
{
public TMP_Text text;
void Update()
{
TextMeshPro textmeshPro = GetComponent();
textmeshPro.SetText("The first number is {0} and the 2nd is {1:2} and the 3rd is {3:0}.", 4, 6.345f, 3.5f);
// The text displayed will be:
// The first number is 4 and the 2nd is 6.35 and the 3rd is 4.
}
}
Подробнее здесь: https://stackoverflow.com/questions/656 ... xtmesh-pro