Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 8b77813

Browse files
committed
only add input component to mesh or model
1 parent 61db414 commit 8b77813

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

β€Žpackages/editor/src/systems/EditorControlSystem.tsxβ€Ž

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { SceneSnapshotAction, SceneState } from '@etherealengine/engine/src/ecs/
5151
import { PresentationSystemGroup } from '@etherealengine/engine/src/ecs/functions/EngineFunctions'
5252
import { InputState } from '@etherealengine/engine/src/input/state/InputState'
5353
import { RendererState } from '@etherealengine/engine/src/renderer/RendererState'
54+
import { useMeshOrModel } from '@etherealengine/engine/src/scene/components/ModelComponent'
5455
import { EditorCameraState } from '../classes/EditorCameraState'
5556
import { TransformGizmoComponent } from '../classes/TransformGizmoComponent'
5657
import { EditorControlFunctions } from '../functions/EditorControlFunctions'
@@ -297,12 +298,16 @@ const execute = () => {
297298
}
298299

299300
const SceneObjectEntityReactor = (props: { entity: Entity }) => {
301+
const isMeshOrModel = useMeshOrModel(props.entity)
302+
300303
useEffect(() => {
304+
if (!isMeshOrModel) return
305+
301306
setComponent(props.entity, InputComponent)
302307
return () => {
303308
removeComponent(props.entity, InputComponent)
304309
}
305-
}, [])
310+
}, [isMeshOrModel])
306311

307312
return null
308313
}

0 commit comments

Comments
Β (0)