This is the 19th day of my participation in the Gwen Challenge in November. Check out the details: The last Gwen Challenge in 2021
Recommended reading
- CSDN home page
- GitHub open source address
- Unity3D plugin sharing
- Jane’s address book
- My personal blog
- QQ group: 1040082875
Hello everyone, I am a Buddhist engineer ☆ quiet small magic dragon ☆, update Unity development skills from time to time, think useful remember one key three link oh.
One, foreword
The attributes and usage methods of each UGUI component, such as Text, Button, Image, Toggle, InputField, ScrollView, etc.
Then share some principles of UGUI, such as UGUI rendering mode, UGUI zoom calculation, UGUI tracing point positioning, UGUI automatic layout and so on.
I believe you will have a more comprehensive understanding of UGUI after reading.
Next, I’ll share an example of the UGUI UI component being applied.
Ii. Introduction and schematic diagram
Share UGUI text implementation progress wait, progress load, process wait demo animation.
The idea is relatively simple, the effect is relatively simple, only for your reference, thank you
Effect demonstration:
Source: download.csdn.net/download/q7…
Three, implementation,
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.