유니티
04/26 유니티 NGUI slider 사용 연습
박준희
2021. 4. 26. 17:01
728x90
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonTest : MonoBehaviour
{
public UIButton btn;
public UISlider slider;
[Range(0f,1f)]
public float sliderValue;
// Start is called before the first frame update
void Start()
{
this.btn.onClick.Add(new EventDelegate(() =>
{
Debug.Log("button clicked!");
}));
StartCoroutine(Check());
}
private IEnumerator Check()
{
while(true)
{
this.slider.value = this.sliderValue;
yield return new WaitForSeconds(1f);
}
}
// Update is called once per frame
void Update()
{
}
}
728x90