From bb244130f6455c0997757abe456e0c454071a846 Mon Sep 17 00:00:00 2001 From: Eric Heine <erheine@nps.edu> Date: Thu, 15 Aug 2019 10:42:46 -0700 Subject: [PATCH] Gave the int variable input the same treatment as the float one so you can delete it all back to 0 if you'd like. --- .../Scriptable Variables/IntVariableInput.cs | 11 ++++++++--- package.json | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Sane Eric's UI/Scriptable Variables/IntVariableInput.cs b/Sane Eric's UI/Scriptable Variables/IntVariableInput.cs index 8e34384..90f579f 100644 --- a/Sane Eric's UI/Scriptable Variables/IntVariableInput.cs +++ b/Sane Eric's UI/Scriptable Variables/IntVariableInput.cs @@ -27,7 +27,12 @@ namespace Shared.SEUI { protected override void AddUIListener(UnityAction<int> callback) { // Define the value converting bridge callback to add to the UI listener valueConverter = delegate(string value) { - callback(Convert.ToInt32(value)); + if (!String.IsNullOrEmpty(input.text)) { + callback(Convert.ToInt32(value)); + } + else { + callback(0); + } }; input.onValueChanged.AddListener(valueConverter); @@ -43,12 +48,12 @@ namespace Shared.SEUI { //--------------------------------------------------------------------------- protected override bool DoValuesMatch() { - return input.text == variable.Value.ToString(); + return !String.IsNullOrEmpty(input.text) && input.text == variable.Value.ToString(); } //--------------------------------------------------------------------------- protected override void UpdateUIValue() { - input.text = variable.Value.ToString(); + input.SetTextWithoutNotify(variable.Value.ToString()); } //--------------------------------------------------------------------------- diff --git a/package.json b/package.json index b6ab928..ee3109c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.futuretech.shared", "displayName": "FutureTech Shared", "description": "Contains shared items such as the Scriptable Variables.", - "version": "0.1.16", + "version": "0.1.17", "unity": "2018.3", "license": "MIT", "repository": { -- GitLab