{"record":{"id":"de9676c01e6ea347","repo":"stride3d/stride","slug":"unable-to-find-the-asset-factory-associated-to-this-template","errorCode":null,"errorMessage":"Unable to find the asset factory associated to this template.","messagePattern":"Unable to find the asset factory associated to this template\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/editor/Stride.Assets.Presentation/Templates/AssetFactoryTemplateGenerator.cs","lineNumber":28,"sourceCode":"    public class AssetFactoryTemplateGenerator : AssetTemplateGenerator\n    {\n        public static readonly AssetFactoryTemplateGenerator Default = new AssetFactoryTemplateGenerator();\n\n        public override bool IsSupportingTemplate(TemplateDescription templateDescription)\n        {\n            if (templateDescription == null) throw new ArgumentNullException(nameof(templateDescription));\n            return templateDescription is TemplateAssetFactoryDescription;\n        }\n\n        protected override IEnumerable<AssetItem> CreateAssets(AssetTemplateGeneratorParameters parameters)\n        {\n            var desc = parameters.Description as TemplateAssetFactoryDescription;\n            if (desc == null)\n                yield break;\n\n            var factory = desc.GetFactory();\n            if (factory == null)\n                throw new InvalidOperationException(\"Unable to find the asset factory associated to this template.\");\n\n            var asset = factory.New();\n            yield return new AssetItem(GenerateLocation(parameters), asset);\n        }\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":35,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/editor/Stride.Assets.Presentation/Templates/AssetFactoryTemplateGenerator.cs#L10-L35","documentation":"AssetFactoryTemplateGenerator.CreateAssets resolves the asset factory from the template's TemplateAssetFactoryDescription via GetFactory(). When the description yields no factory, it throws InvalidOperationException because it cannot create the template's assets.","triggerScenarios":"Applying a new-asset template whose TemplateAssetFactoryDescription.GetFactory() returns null — e.g. the template description references a factory type/id that is not registered or fails to resolve.","commonSituations":"Custom asset templates written for a different Stride version whose factory registration no longer resolves; template description typos or missing plugin assemblies at editor startup.","solutions":["Verify the template description's factory type/id is correct and that the assembly providing the factory is loaded","Check the associated AssetFactory is registered (AttributeRegistry / factory registration ran) before the template is used","Update or rewrite the custom template to match the current Stride template-description schema"],"exampleFix":"// before\ndescription.Factory = null; // or unresolved type string\n// after\ndescription.Factory = typeof(MyAssetFactory); // concrete registered factory","handlingStrategy":"type-guard","validationCode":"var factory = desc?.GetFactory();\nif (factory == null) { /* handle missing factory before proceeding */ }","typeGuard":"bool HasFactory(TemplateAssetFactoryDescription d) => d?.GetFactory() != null;","tryCatchPattern":"try { foreach (var a in gen.CreateAssets(parameters)) yield return a; }\ncatch (InvalidOperationException) { // report template misconfiguration in the UI\n}","preventionTips":["Ensure the assembly containing the AssetFactory is referenced and loaded by the editor","Test custom templates by actually applying them, not just registering them","Keep template factory type references in sync with the current Stride API version"],"tags":["stride","templates","assets"],"backgroundTag":"resource-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}