Home>
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
public class TextChange: MonoBehaviour
{
    public Text Ctext;
    public float ChangeTimer;
Public float NT;
Public Image BackGround;
    // Start is called before the first frame update
    void Start ()
    {

    }
    // Update is called once per frame
    void Update ()
    {
        Ctext.text = "Loading.";
        Ctext.text = "Loading ..";
        Ctext.text = "Loading ...";
        Ctext.text = "Loading";

    }
}

There is a text originally written "Loadong ...". Attach this script, and repeat the "..." part NT times as "." ".." "..." "Disappear" "." ".." at the ChangeTimer interval I want to When the display is finished, make the BackGround transparent and erase it. (Destroy).
I did not understand the notation method.

  • Answer # 1

    What do you want to do roughly?
    After that, please add an appropriate production

    bool loop = false;
    IEnumerator Loading () {
      int period = 0;
      while (loop) {
        Ctext.text = "Loading" + new String ('.', Period);
        period ++;
        period% = 4;
        yield return new WaitForSeconds (ChangeTimer);
      }
      Destory ();
    }
    // How to use, execute the following code once when loading starts
    loop = true;
    StartCoroutine (Loading ());
    // After loading, set loop to false
    loop = false;

Related articles