NG_/Data Visualization Resources/Scripts/SliderRunTo1A.cs
2024-12-13 18:49:44 +08:00

37 lines
475 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SliderRunTo1A : MonoBehaviour
{
public bool b=true;
public Slider slider;
public float speed=0.5f;
float time =0f;
void Start()
{
slider = GetComponent<Slider>();
}
void Update()
{
if(b)
{
time+=Time.deltaTime*speed;
slider.value = time;
if(time>1)
{
time=0;
}
}
}
}