summaryrefslogtreecommitdiff
path: root/Assets/SampleUI/Scripts/ShowSliderValue.cs
diff options
context:
space:
mode:
authornirav <nirav@airmail.cc>2020-12-12 07:18:36 +0000
committernirav <nirav@airmail.cc>2020-12-12 07:18:36 +0000
commit115f77bda0246a00f6e17469685c67746bdbd29d (patch)
tree4bbea1e59109bb1d1fddc71736f89289bab03073 /Assets/SampleUI/Scripts/ShowSliderValue.cs
download01-master.tar.gz
01-master.zip
Initial commitHEADmaster
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) + "%";
+ }
+}