diff --git a/include/Engine/Core/ComponentInfo.h b/include/Engine/Core/ComponentInfo.h index 909224e2..abf4ff15 100644 --- a/include/Engine/Core/ComponentInfo.h +++ b/include/Engine/Core/ComponentInfo.h @@ -21,6 +21,7 @@ struct ComponentInfo std::string Name; std::unordered_map Fields; + std::vector FieldsInOrder; Meta_t Meta; std::shared_ptr Defaults = nullptr; }; diff --git a/src/Engine/Core/EntityFilePreprocessor.cpp b/src/Engine/Core/EntityFilePreprocessor.cpp index 4fd768a1..83e2fe28 100644 --- a/src/Engine/Core/EntityFilePreprocessor.cpp +++ b/src/Engine/Core/EntityFilePreprocessor.cpp @@ -143,9 +143,11 @@ void EntityFilePreprocessor::parseComponentInfo() continue; } - compInfo.Fields[name].Type = type; - compInfo.Fields[name].Offset = fieldOffset; - compInfo.Fields[name].Stride = stride; + auto& field = compInfo.Fields[name]; + field.Type = type; + field.Offset = fieldOffset; + field.Stride = stride; + compInfo.FieldsInOrder.push_back(&field); fieldOffset += stride; }