@relu-interactives/spatial-ecs 0.2.22 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5410,9 +5410,9 @@ var _ScriptObjectSystem = class _ScriptObjectSystem {
5410
5410
  } catch {
5411
5411
  instance = new ctor(world, entityId, currentData);
5412
5412
  }
5413
- const defaults = normalizeScriptData(instance.data);
5414
- const merged = mergeDataByCurrentDefaults(defaults, currentData);
5415
- instance.data = resolveInputData(world, merged);
5413
+ const literalDefaults = normalizeScriptData(instance.data);
5414
+ const seed = Object.keys(literalDefaults).length > 0 ? mergeDataByCurrentDefaults(literalDefaults, currentData) : { ...currentData };
5415
+ instance.data = resolveInputData(world, seed);
5416
5416
  const parent = world.getComponent(entityId, Object3DRef)?.object;
5417
5417
  if (!parent) {
5418
5418
  throw new Error("Script object entity has no Object3D to attach to.");
@@ -5442,6 +5442,13 @@ var _ScriptObjectSystem = class _ScriptObjectSystem {
5442
5442
  built.userData[SCRIPT_OBJECT_ROOT_FLAG] = true;
5443
5443
  parent.add(built);
5444
5444
  instance.root = built;
5445
+ const postBuildData = normalizeScriptData(instance.data);
5446
+ const schemaDefaults = { ...literalDefaults };
5447
+ for (const [key2, value] of Object.entries(postBuildData)) {
5448
+ if (!(key2 in schemaDefaults)) schemaDefaults[key2] = value;
5449
+ }
5450
+ const merged = mergeDataByCurrentDefaults(schemaDefaults, currentData);
5451
+ instance.data = resolveInputData(world, merged);
5445
5452
  const stored = serializeDataForStorage(merged, merged);
5446
5453
  component.data = stored;
5447
5454
  component.runtimeState = "ready";
@@ -5802,5 +5809,5 @@ __name(_VideoSystem, "VideoSystem");
5802
5809
  var VideoSystem = _VideoSystem;
5803
5810
 
5804
5811
  export { ADDED_NODE_MARKER_COMPONENT, AnimationSystem, AudioSystem, Behaviour, CameraSyncSystem, EnvironmentSyncSystem, HYDRATABLE_ENTITY_KINDS, InputSystem, InstancedMeshSystem, KeyboardKeys, LightSyncSystem, MaterialSyncSystem, MeshGeometrySystem, NODE_KEY_SEPARATOR, OVERRIDE_DIFF_EXCLUDED_COMPONENTS, OVERRIDE_ROOT_EXCLUDED_COMPONENTS, ObjectVisibilitySystem, PREFAB_FILE_VERSION, PREFAB_FILE_VERSION_NESTED, PhysicsSyncSystem, PostprocessingSyncSystem, RenderSystem, SCRIPT_OBJECT_ROOT_FLAG, ScriptBehaviourSystem, ScriptObject, ScriptObjectSystem, TransformSyncSystem, VideoSystem, buildComponentValueMaps, buildNodeKeyMapsFromSnapshot, buildNodeMapsFromSnapshot, canonicalizeComponentValue, clearPrefabCache, collectDiffPaths, collectEntitySubtree, collectSnapshotSubtreeIds, computeInstanceOverrides, decanonicalizeComponentValue, despawnPrefab, encodeOverride, findSnapshotRootEntityIds, findTopLevelNestedRegions, groupOverridePaths, hydrateWorldFromSnapshot, hydrateWorldFromSnapshotDetailed, indexSnapshotByEntity, instantiateSubtree, loadPrefab, mergeComponentValue, parseOverride, parsePrefabAsset, prefabFileVersionFor, restoreComponentState, restorePostCreateComponents, setPrefabAssetUrlResolver, spawnPrefab };
5805
- //# sourceMappingURL=chunk-GZ2NKSMV.js.map
5806
- //# sourceMappingURL=chunk-GZ2NKSMV.js.map
5812
+ //# sourceMappingURL=chunk-7BEZBIVB.js.map
5813
+ //# sourceMappingURL=chunk-7BEZBIVB.js.map