SimpleProgress1.cs 563 B

12345678910111213141516171819202122232425262728293031323334353637
  1. 
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class SimpleProgress1 : MonoBehaviour
  7. {
  8. public bool b = true;
  9. public Image image;
  10. public float speed;
  11. float time = 0f;
  12. public void Start()
  13. {
  14. image = GetComponent<Image>();
  15. }
  16. void Update()
  17. {
  18. if (b)
  19. {
  20. time += Time.deltaTime * speed;
  21. image.fillAmount = time;
  22. if (time > 1)
  23. {
  24. time = 0;
  25. }
  26. }
  27. }
  28. }