ShowSliderValue.cs 305 B

1234567891011121314
  1. using System.Reflection.Emit;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. [RequireComponent(typeof(Text))]
  5. public class ShowSliderValue : MonoBehaviour
  6. {
  7. public void UpdateLabel (float value)
  8. {
  9. Text lbl = GetComponent<Text>();
  10. if (lbl != null)
  11. lbl.text = Mathf.RoundToInt (value * 100) + "%";
  12. }
  13. }