Skip to content

Commit 5302118

Browse files
author
Julia Schwarz
committed
ShowSliderValue show only 2 decimal places.
1 parent cf60402 commit 5302118

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Assets/MixedRealityToolkit.Examples/Demos/UX/Slider/Scripts/ShowSliderValue.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@ public class ShowSliderValue : MonoBehaviour
1313
{
1414
[SerializeField]
1515
private TextMesh textMesh = null;
16-
private void Start()
16+
17+
public void OnSliderUpdated(SliderEventData eventData)
1718
{
1819
if (textMesh == null)
1920
{
2021
textMesh = GetComponent<TextMesh>();
2122
}
22-
}
23-
public void OnSliderUpdated(SliderEventData eventData)
24-
{
23+
2524
if (textMesh != null)
2625
{
27-
textMesh.text = $"{eventData.NewValue}";
26+
textMesh.text = $"{eventData.NewValue:F2}";
2827
}
2928
}
3029
}

0 commit comments

Comments
 (0)