@galacean/engine-loader 1.2.0-alpha.5 → 1.2.0-alpha.8

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.
package/dist/main.js CHANGED
@@ -980,6 +980,7 @@ var HierarchyParser = /*#__PURE__*/ function() {
980
980
  }
981
981
  };
982
982
  _proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
983
+ if (entityConfig === void 0) entityConfig = {};
983
984
  var _entityConfig_isActive;
984
985
  entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : entity.isActive;
985
986
  var _entityConfig_name;
@@ -992,12 +993,18 @@ var HierarchyParser = /*#__PURE__*/ function() {
992
993
  };
993
994
  _proto._traverseAddEntityToMap = function _traverseAddEntityToMap(entity, context, path) {
994
995
  var entityMap = context.entityMap, components = context.components;
996
+ var componentsMap = {};
997
+ var componentIndexMap = {};
995
998
  entityMap.set(path, entity);
996
999
  // @ts-ignore
997
1000
  entity._components.forEach(function(component) {
998
1001
  // @ts-ignore
999
1002
  var name = engineCore.Loader.getClassName(component.constructor);
1000
- components.set(path + ":" + name, component);
1003
+ if (!componentsMap[name]) {
1004
+ componentsMap[name] = entity.getComponents(component.constructor, []);
1005
+ componentIndexMap[name] = 0;
1006
+ }
1007
+ components.set(path + ":" + name + "/" + componentIndexMap[name]++, component);
1001
1008
  });
1002
1009
  for(var i = 0; i < entity.children.length; i++){
1003
1010
  var child = entity.children[i];