From e8e891c863489d161f7fa2d2f90c754e0c6da6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ei=C3=B0ur=20Sveinn=20Gunnarsson?= Date: Fri, 11 May 2018 14:30:41 +0000 Subject: [PATCH] Fix StandardInput singleton bug Previously the logic only checked whether the variable storing the singleton instance was null and if not destroyed it. However that doesn't take into account that the StandardInput component may have been disabled and then re-enabled and that this is the same instance as the one we had stored. --- .../Assets/TouchScript/Scripts/InputSources/StandardInput.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Assets/TouchScript/Scripts/InputSources/StandardInput.cs b/Source/Assets/TouchScript/Scripts/InputSources/StandardInput.cs index 64e38e5f2..7570e4019 100644 --- a/Source/Assets/TouchScript/Scripts/InputSources/StandardInput.cs +++ b/Source/Assets/TouchScript/Scripts/InputSources/StandardInput.cs @@ -267,7 +267,7 @@ public override bool CancelPointer(Pointer pointer, bool shouldReturn) /// protected override void OnEnable() { - if (instance != null) Destroy(instance); + if (instance != null && instance != this) Destroy(instance); instance = this; base.OnEnable(); @@ -453,4 +453,4 @@ private void disableWindows8Touch() #endregion } -} \ No newline at end of file +}