diff --git a/Sources/GateEngine/ECS/Base/Entity.swift b/Sources/GateEngine/ECS/Base/Entity.swift index 64845ce0..b4c7301c 100755 --- a/Sources/GateEngine/ECS/Base/Entity.swift +++ b/Sources/GateEngine/ECS/Base/Entity.swift @@ -97,6 +97,9 @@ extension Entity { _ type: T.Type, _ config: @escaping (_ component: inout T) async -> ResultType ) async -> ResultType { + if self.hasComponent(type) == false { + self.insert(type.init()) + } return await config(&self[T.self]) }