summaryrefslogtreecommitdiff
path: root/Assets/SampleUI/Scripts/ShowSliderValue.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/SampleUI/Scripts/ShowSliderValue.cs')
-rwxr-xr-xAssets/SampleUI/Scripts/ShowSliderValue.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Assets/SampleUI/Scripts/ShowSliderValue.cs b/Assets/SampleUI/Scripts/ShowSliderValue.cs
new file mode 100755
index 0000000..99b30aa
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ShowSliderValue.cs
@@ -0,0 +1,14 @@
+using System.Reflection.Emit;
+using UnityEngine;
+using UnityEngine.UI;
+
+[RequireComponent(typeof(Text))]
+public class ShowSliderValue : MonoBehaviour
+{
+ public void UpdateLabel (float value)
+ {
+ Text lbl = GetComponent<Text>();
+ if (lbl != null)
+ lbl.text = Mathf.RoundToInt (value * 100) + "%";
+ }
+}