Currently I have an EquipmentEngineBase : ComponentSystem and
EquipmentEngine : EquipmentEngineBase
UnEquipmentEngine : EquipmentEngineBase
When I add these 2 systems the ECS throws an error in ComponentGroup.cs, the type has already been added to the dictionary.
A check if it already contains this type is sufficient and both systems work correctly. I just wonder if it has any negative side effects.
The full code:
public ComponentGroup(EntityManager entityManager, params Type[] componentTypes) {
_entityManager = entityManager;
_groupMatcher = new GroupMatcher(componentTypes);
foreach (Type type in componentTypes) {
Type componentArrayType = typeof(ComponentArray<>);
Type genericComponentArrayType = componentArrayType.MakeGenericType(type);
if (!_components.ContainsKey(type)) // added
_components.Add(type, (ComponentArray)Activator.CreateInstance(genericComponentArrayType));
}
}
Currently I have an EquipmentEngineBase : ComponentSystem and
When I add these 2 systems the ECS throws an error in ComponentGroup.cs, the type has already been added to the dictionary. A check if it already contains this type is sufficient and both systems work correctly. I just wonder if it has any negative side effects.
The full code: