# ComponentFactoryRegistry::RegisterFactory 注册对象、回调或映射。 ```cpp void RegisterFactory(const std::string& typeName, CreateComponentFn createFn); ``` 该方法声明于 `XCEngine/Components/ComponentFactoryRegistry.h`,当前页面用于固定 `ComponentFactoryRegistry` 类目录下的方法级 canonical 路径。 **参数:** - `typeName` - 参数语义详见头文件声明。 - `createFn` - 参数语义详见头文件声明。 **返回:** `void` - 无返回值。 **示例:** ```cpp #include void Example() { XCEngine::Components::ComponentFactoryRegistry object; // 根据上下文补齐参数后调用 ComponentFactoryRegistry::RegisterFactory(...)。 (void)object; } ``` ## 相关文档 - [返回类总览](ComponentFactoryRegistry.md) - [返回模块目录](../Components.md)