From 5b44420d00b7d35db55274cde4b40c3f67922da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Fejzagi=C4=87?= Date: Thu, 9 Nov 2023 22:29:44 +0100 Subject: [PATCH] Reset IsInputDown when source is lost --- .../FarInteractorLine.mat} | 2 +- .../FarInteractorLine.mat.meta} | 0 Runtime/Input/Interactors/BaseInteractor.cs | 11 +++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) rename Assets~/StandardAssets/{Materials/DefaultPointerLine.mat => Interactors/FarInteractorLine.mat} (99%) rename Assets~/StandardAssets/{Materials/DefaultPointerLine.mat.meta => Interactors/FarInteractorLine.mat.meta} (100%) diff --git a/Assets~/StandardAssets/Materials/DefaultPointerLine.mat b/Assets~/StandardAssets/Interactors/FarInteractorLine.mat similarity index 99% rename from Assets~/StandardAssets/Materials/DefaultPointerLine.mat rename to Assets~/StandardAssets/Interactors/FarInteractorLine.mat index abab195f0..ce47f7ed8 100644 --- a/Assets~/StandardAssets/Materials/DefaultPointerLine.mat +++ b/Assets~/StandardAssets/Interactors/FarInteractorLine.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: DefaultPointerLine + m_Name: FarInteractorLine m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} m_ShaderKeywords: _ALPHABLEND_ON _BORDER_LIGHT_USES_HOVER_COLOR _DISABLE_ALBEDO_MAP _GLOSSYREFLECTIONS_OFF _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _SPECULARHIGHLIGHTS_OFF diff --git a/Assets~/StandardAssets/Materials/DefaultPointerLine.mat.meta b/Assets~/StandardAssets/Interactors/FarInteractorLine.mat.meta similarity index 100% rename from Assets~/StandardAssets/Materials/DefaultPointerLine.mat.meta rename to Assets~/StandardAssets/Interactors/FarInteractorLine.mat.meta diff --git a/Runtime/Input/Interactors/BaseInteractor.cs b/Runtime/Input/Interactors/BaseInteractor.cs index 1a440c4f2..3696315a9 100644 --- a/Runtime/Input/Interactors/BaseInteractor.cs +++ b/Runtime/Input/Interactors/BaseInteractor.cs @@ -397,6 +397,17 @@ public override void OnInputUp(InputEventData eventData) base.OnInputDown(eventData); } + /// + public override void OnSourceLost(SourceStateEventData eventData) + { + if (eventData.SourceId == InputSource.SourceId) + { + inputDownActions.Clear(); + } + + base.OnSourceLost(eventData); + } + private void DragHandler(InputAction action) { if (IsDragging)