Skip to content

Commit f8e20c9

Browse files
committed
Fixes Decimal point issue
* adds the ability to put manual entries into the text box
1 parent 6b63521 commit f8e20c9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Assets/Scripts/Resources/GuiHelper.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ private static string FloatToString(float num, int length)
1919
public static bool Slider(Rect rect, string title, float value, string textValue, out float outValue,
2020
out string outTextValue, float minValue, float maxValue)
2121
{
22+
2223
if (textValue == null) textValue = value.ToString();
2324

2425
var offsetX = (int) rect.x;
@@ -55,6 +56,12 @@ public static bool Slider(Rect rect, string title, float value, string textValue
5556
if (Math.Abs(value - tempValue) > 0.0001f) isChanged = true;
5657
}
5758

59+
float floatValue = 0.0f;
60+
float.TryParse(textValue, out floatValue);
61+
if(floatValue != value)
62+
{
63+
value = floatValue;
64+
}
5865
outValue = value;
5966
outTextValue = textValue;
6067

0 commit comments

Comments
 (0)