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

Commit

Permalink
fix bug with setComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Mar 8, 2023
1 parent ac0f10e commit a4e4206
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/engine/src/ecs/functions/ComponentFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export const setComponent = <C extends Component>(
if (!Component.stateMap[entity]) {
const state = hookstate(value, subscribable())
Component.stateMap[entity] = state
state.subscribe((value) => {
Component.valueMap[entity] = value
state.subscribe(() => {
Component.valueMap[entity] = Component.stateMap[entity]?.get(NO_PROXY)
})
} else Component.stateMap[entity]!.set(value)
bitECS.addComponent(Engine.instance, Component, entity, false) // don't clear data on-add
Expand Down

0 comments on commit a4e4206

Please sign in to comment.