powerfun-unity/Assets/LoadingAnimation.cs

40 lines
803 B
C#
Raw Normal View History

2021-04-16 17:49:11 +08:00
using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LoadingAnimation : MonoBehaviour
{
// Start is called before the first frame update
[SerializeField] Color c;
void Start()
{
Refresh();
}
// Update is called once per frame
void Update()
{
}
void OnRectTransformDimensionsChange()
{
Refresh();
}
private void OnValidate()
{
Refresh();
}
void Refresh()
{
Transform L = transform.Find("L"), R = transform.Find("R");
if (L && R && c.a!=0)
{
transform.Find("L").GetComponent<Image>().color = c;
transform.Find("R").GetComponent<Image>().color = c;
}
}
}