From 27dbc6ea2af2b48618cfdd7cde9e9a93aac54b17 Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Fri, 14 Aug 2026 11:56:58 +0300 Subject: [PATCH] `register_resource_type` helper method --- fyrox-resource/src/manager.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fyrox-resource/src/manager.rs b/fyrox-resource/src/manager.rs index b44c07021..786f8a6e5 100644 --- a/fyrox-resource/src/manager.rs +++ b/fyrox-resource/src/manager.rs @@ -772,6 +772,16 @@ impl ResourceManager { self.state().add_loader(loader) } + /// Registers a pair of resource type and its respective loader in the resource manager. + pub fn register_resource_type(&self, loader: L) + where + T: TypedResourceData, + L: ResourceLoader, + { + self.add_loader(loader); + self.state().constructors_container.add::(); + } + /// Add the given resource to the manager and registers the resource as an external resource with the given /// path, updating the metadata file with the resource's UUID and updating the registry file with the resource's path. /// Calling this should only be necessary after newly creating the file in the given path by saving the resource