From 6337bf19fd2b78ba68a486dc14fae508e43c6065 Mon Sep 17 00:00:00 2001 From: Gerardo Marset Date: Fri, 1 Jul 2016 13:30:44 -0300 Subject: [PATCH] Cache the current StandaloneInputModule. --- Assets/Fungus/Narrative/Scripts/DialogInput.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Narrative/Scripts/DialogInput.cs b/Assets/Fungus/Narrative/Scripts/DialogInput.cs index dd2412bc..0f85bef3 100644 --- a/Assets/Fungus/Narrative/Scripts/DialogInput.cs +++ b/Assets/Fungus/Narrative/Scripts/DialogInput.cs @@ -42,6 +42,8 @@ namespace Fungus protected float ignoreClickTimer; + protected StandaloneInputModule currentStandaloneInputModule; + /** * Trigger next line input event from script. */ @@ -80,9 +82,11 @@ namespace Fungus protected virtual void Update() { - StandaloneInputModule currentInputModule = EventSystem.current.GetComponent(); - if (Input.GetButtonDown(currentInputModule.submitButton) || - (cancelEnabled && Input.GetButton(currentInputModule.cancelButton))) + if (currentStandaloneInputModule == null) + currentStandaloneInputModule = EventSystem.current.GetComponent(); + + if (Input.GetButtonDown(currentStandaloneInputModule.submitButton) || + (cancelEnabled && Input.GetButton(currentStandaloneInputModule.cancelButton))) { SetNextLineFlag(); }