A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix: Use emplaceOrReplace instead of replace in ECS bindings
esengine15e88829e780
diff --git a/src/esengine/scripting/bindings/ECSBindings.cpp b/src/esengine/scripting/bindings/ECSBindings.cppindex f282b5405..c9fa3b4e1 100644--- a/src/esengine/scripting/bindings/ECSBindings.cpp+++ b/src/esengine/scripting/bindings/ECSBindings.cpp@@ -267,11 +267,7 @@ static JSValue js_Registry_setTransform(JSContext* ctx, JSValue this_val, int arJS_FreeValue(ctx, jsScale);// Set or add component- if (g_registry->has<ecs::LocalTransform>(entity)) {- g_registry->replace<ecs::LocalTransform>(entity, transform);- } else {- g_registry->emplace<ecs::LocalTransform>(entity, transform);- }+ g_registry->emplaceOrReplace<ecs::LocalTransform>(entity, transform);return JS_UNDEFINED;}@@ -354,11 +350,7 @@ static JSValue js_Registry_setVelocity(JSContext* ctx, JSValue this_val, int arg}JS_FreeValue(ctx, jsAngular);- if (g_registry->has<ecs::Velocity>(entity)) {- g_registry->replace<ecs::Velocity>(entity, velocity);- } else {- g_registry->emplace<ecs::Velocity>(entity, velocity);- }+ g_registry->emplaceOrReplace<ecs::Velocity>(entity, velocity);return JS_UNDEFINED;}