{"record":{"id":"655acce7dd2022d0","repo":"OpenRA/OpenRA","slug":"tileselectorlogic-requires-a-template-based-tilese","errorCode":null,"errorMessage":"TileSelectorLogic requires a template-based tileset.","messagePattern":"TileSelectorLogic requires a template-based tileset\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"error","filePath":"OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs","lineNumber":54,"sourceCode":"\t\t\tpublic TileSelectorTemplate(TerrainTemplateInfo template)\n\t\t\t{\n\t\t\t\tTemplate = template;\n\t\t\t\tCategories = template.Categories;\n\t\t\t\tTooltip = template.Id.ToString(NumberFormatInfo.CurrentInfo);\n\t\t\t\tSearchTerms = [Tooltip];\n\t\t\t}\n\t\t}\n\n\t\treadonly ITemplatedTerrainInfo terrainInfo;\n\t\treadonly ImmutableArray<TileSelectorTemplate> allTemplates;\n\n\t\t[ObjectCreator.UseCtor]\n\t\tpublic TileSelectorLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer)\n\t\t\t: base(widget, modData, world, worldRenderer, \"TILETEMPLATE_LIST\", \"TILEPREVIEW_TEMPLATE\")\n\t\t{\n\t\t\tterrainInfo = world.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;\n\t\t\tif (terrainInfo == null)\n\t\t\t\tthrow new InvalidDataException(\"TileSelectorLogic requires a template-based tileset.\");\n\n\t\t\tallTemplates = terrainInfo.TemplatesInDefinitionOrder.Select(t => new TileSelectorTemplate(t)).ToImmutableArray();\n\n\t\t\tallCategories = allTemplates.SelectMany(t => t.Categories)\n\t\t\t\t.Distinct()\n\t\t\t\t.OrderBy(CategoryOrder)\n\t\t\t\t.ToArray();\n\n\t\t\tforeach (var c in allCategories)\n\t\t\t{\n\t\t\t\tSelectedCategories.Add(c);\n\t\t\t\tFilteredCategories.Add(c);\n\t\t\t}\n\n\t\t\tSearchTextField.OnTextEdited = () =>\n\t\t\t{\n\t\t\t\tsearchFilter = SearchTextField.Text.Trim();\n\t\t\t\tFilteredCategories.Clear();","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/OpenRA/OpenRA/blob/a520984d91eda9de48a62b1d15c1e3bad0d4fb1a/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs#L36-L72","documentation":"Thrown by the TileSelectorLogic constructor when the map's terrain info does not implement ITemplatedTerrainInfo. The editor's tile selector requires a template-based terrain system to enumerate and display terrain templates. The cast from map.Rules.TerrainInfo to ITemplatedTerrainInfo fails for non-template terrain implementations.","triggerScenarios":"Opening the terrain tile selector in the map editor with a map whose tileset uses a terrain implementation that does not implement ITemplatedTerrainInfo.","commonSituations":"Using a custom terrain system that doesn't implement ITemplatedTerrainInfo, or loading a mod with an incompatible terrain renderer in the editor.","solutions":["Ensure the map uses a tileset backed by ITemplatedTerrainInfo (the standard for all stock OpenRA mods)","Implement ITemplatedTerrainInfo on the custom terrain info type if using a custom terrain system","Disable or replace the TileSelectorLogic with a compatible selector for non-template terrain"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Check terrain info type before constructing TileSelectorLogic\nif (world.Map.Rules.TerrainInfo is not ITemplatedTerrainInfo)\n    Console.Error.WriteLine(\"TileSelectorLogic requires ITemplatedTerrainInfo. Current tileset is incompatible.\");","tryCatchPattern":null,"preventionTips":["Verify the tileset implements ITemplatedTerrainInfo before opening the tile selector","Use stock OpenRA tilesets which always implement ITemplatedTerrainInfo","Implement ITemplatedTerrainInfo on custom terrain info types if editor support is needed"],"tags":["openra","editor","terrain","tileset","type-mismatch","config"],"backgroundTag":null,"analyzedSha":"a520984d91eda9de48a62b1d15c1e3bad0d4fb1a","analyzedAt":"2026-08-13T15:30:14.787Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}