Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using UnityEngine;
using static UIconfig;
public class LoadingCircle : MonoBehaviour
{
private RectTransform rectComponent;
public float rotateSpeed = -200f;
private float width=100;
private float height=100;
public float scale;
private void Start()
{
rectComponent = GetComponent<RectTransform>();
}
private void Update()
{
rectComponent.Rotate(0f, 0f, rotateSpeed * Time.deltaTime);
if (scale != 0)
{
width = screWidth / scale;
height = screHeight / scale;
if (width < height)
{
width = height;
}
else
{
height = width;
}
rectComponent.sizeDelta = new Vector2(width, height);
}
}
}