From e6e60802b7cfb591320e85084b8eedb1d80303a3 Mon Sep 17 00:00:00 2001 From: Gheric Speiginer Date: Thu, 31 Aug 2023 12:11:51 -0700 Subject: [PATCH] Disable highlight for xrui entities --- .../engine/src/input/components/InputComponent.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/engine/src/input/components/InputComponent.ts b/packages/engine/src/input/components/InputComponent.ts index 51c28e9edd..a6039c859e 100644 --- a/packages/engine/src/input/components/InputComponent.ts +++ b/packages/engine/src/input/components/InputComponent.ts @@ -26,9 +26,16 @@ Ethereal Engine. All Rights Reserved. import { useLayoutEffect } from 'react' import { Entity } from '../../ecs/classes/Entity' -import { defineComponent, removeComponent, setComponent, useComponent } from '../../ecs/functions/ComponentFunctions' +import { + defineComponent, + hasComponent, + removeComponent, + setComponent, + useComponent +} from '../../ecs/functions/ComponentFunctions' import { useEntityContext } from '../../ecs/functions/EntityFunctions' import { HighlightComponent } from '../../renderer/components/HighlightComponent' +import { XRUIComponent } from '../../xrui/components/XRUIComponent' export const InputComponent = defineComponent({ name: 'InputComponent', @@ -53,7 +60,7 @@ export const InputComponent = defineComponent({ const input = useComponent(entity, InputComponent) useLayoutEffect(() => { if (!input.inputSources.length || !input.highlight.value) return - setComponent(entity, HighlightComponent) + if (!hasComponent(entity, XRUIComponent)) setComponent(entity, HighlightComponent) return () => { removeComponent(entity, HighlightComponent) }