24 lines
541 B
C#
24 lines
541 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class SliderIndicator : MonoBehaviour
|
|
{
|
|
public Slider slider;
|
|
public Text text;
|
|
void Start()
|
|
{
|
|
slider.onValueChanged.AddListener(OnChanged);
|
|
text.text = slider.value.ToString();
|
|
}
|
|
|
|
void OnChanged(float value){
|
|
text.text = slider.value.ToString();
|
|
}
|
|
|
|
void OnValidate(){
|
|
if(GetComponent<Text>()!=null && text==null)
|
|
text = GetComponent<Text>();
|
|
}
|
|
}
|