diff options
author | nirav <nirav@airmail.cc> | 2020-12-12 07:18:36 +0000 |
---|---|---|
committer | nirav <nirav@airmail.cc> | 2020-12-12 07:18:36 +0000 |
commit | 115f77bda0246a00f6e17469685c67746bdbd29d (patch) | |
tree | 4bbea1e59109bb1d1fddc71736f89289bab03073 /Assets/SampleUI/Scripts/ShowSliderValue.cs | |
download | 01-master.tar.gz 01-master.zip |
Diffstat (limited to 'Assets/SampleUI/Scripts/ShowSliderValue.cs')
-rwxr-xr-x | Assets/SampleUI/Scripts/ShowSliderValue.cs | 14 |
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) + "%"; + } +} |