From 115f77bda0246a00f6e17469685c67746bdbd29d Mon Sep 17 00:00:00 2001 From: nirav Date: Sat, 12 Dec 2020 07:18:36 +0000 Subject: Initial commit --- Assets/SampleUI/Scripts/ShowSliderValue.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 Assets/SampleUI/Scripts/ShowSliderValue.cs (limited to 'Assets/SampleUI/Scripts/ShowSliderValue.cs') 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(); + if (lbl != null) + lbl.text = Mathf.RoundToInt (value * 100) + "%"; + } +} -- cgit v1.2.3