Firstborn/Assets/RPG Creation Kit/Scripts/_ General/UI/UISliderValueDisplayer.cs

25 lines
631 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
namespace RPGCreationKit
{
public class UISliderValueDisplayer : MonoBehaviour
{
[SerializeField] private Slider slider;
[SerializeField] private TextMeshProUGUI _text;
public bool IsAudio = false;
public void Update() {
if (IsAudio == false) {
_text.text = slider.value.ToString("F2");
} else {
float NewValue = slider.value * 100;
_text.text = NewValue.ToString("F2");
}
}
}
}