One, foreword
Today share UGUI text to achieve progress waiting, progress loading, process waiting demo animation, the implementation of ideas is relatively simple, the effect is relatively simple, just for your reference, thank you
Effect demonstration:
Second, the resource
Source: download.csdn.net/download/q7…
Third, the body
Write the script textloading.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TextLoading : MonoBehaviour
{
public Text m_Text;
float m_CurProgressValue2 = 0;
float m_ProgressValue2 = 100;
float m_CurProgressValueTemp = 0;
void Update()
{
if (m_CurProgressValue2 < m_ProgressValue2)
{
m_CurProgressValue2++;
}
if (m_CurProgressValue2 == 100)
{
m_CurProgressValue2 = 0;
}
m_CurProgressValueTemp = m_CurProgressValue2 / 100f;
if (m_CurProgressValueTemp > 0.1 f && m_CurProgressValueTemp <= 0.3 f)
{
m_Text.text = A. a. a. a. "low";
}
else if (m_CurProgressValueTemp > 0.3 f && m_CurProgressValueTemp <= 0.5 f)
{
m_Text.text = A. a. a. a. "low";
}
else if (m_CurProgressValueTemp > 0.5 f && m_CurProgressValueTemp <= 0.7 f)
{
m_Text.text = Author, a. a. a. low "";
}
else if (m_CurProgressValueTemp > 0.7 f && m_CurProgressValueTemp <= 0.9 f)
{
m_Text.text = A. a. a. a. "low";
}
else
{
m_Text.text = Author, a. a. "a." "; }}}Copy the code
The code is simple, so I won’t comment it out