OpenRA/OpenRA · error · InvalidDataException

TileSelectorLogic requires a template-based tileset.

Error message

TileSelectorLogic requires a template-based tileset.

What it means

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.

Source

Thrown at OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs:54

			public TileSelectorTemplate(TerrainTemplateInfo template)
			{
				Template = template;
				Categories = template.Categories;
				Tooltip = template.Id.ToString(NumberFormatInfo.CurrentInfo);
				SearchTerms = [Tooltip];
			}
		}

		readonly ITemplatedTerrainInfo terrainInfo;
		readonly ImmutableArray<TileSelectorTemplate> allTemplates;

		[ObjectCreator.UseCtor]
		public TileSelectorLogic(Widget widget, ModData modData, World world, WorldRenderer worldRenderer)
			: base(widget, modData, world, worldRenderer, "TILETEMPLATE_LIST", "TILEPREVIEW_TEMPLATE")
		{
			terrainInfo = world.Map.Rules.TerrainInfo as ITemplatedTerrainInfo;
			if (terrainInfo == null)
				throw new InvalidDataException("TileSelectorLogic requires a template-based tileset.");

			allTemplates = terrainInfo.TemplatesInDefinitionOrder.Select(t => new TileSelectorTemplate(t)).ToImmutableArray();

			allCategories = allTemplates.SelectMany(t => t.Categories)
				.Distinct()
				.OrderBy(CategoryOrder)
				.ToArray();

			foreach (var c in allCategories)
			{
				SelectedCategories.Add(c);
				FilteredCategories.Add(c);
			}

			SearchTextField.OnTextEdited = () =>
			{
				searchFilter = SearchTextField.Text.Trim();
				FilteredCategories.Clear();

View on GitHub (pinned to a520984d91)

Solutions

  1. Ensure the map uses a tileset backed by ITemplatedTerrainInfo (the standard for all stock OpenRA mods)
  2. Implement ITemplatedTerrainInfo on the custom terrain info type if using a custom terrain system
  3. Disable or replace the TileSelectorLogic with a compatible selector for non-template terrain
Defensive patterns

Strategy: type-guard

Type guard

// Check terrain info type before constructing TileSelectorLogic
if (world.Map.Rules.TerrainInfo is not ITemplatedTerrainInfo)
    Console.Error.WriteLine("TileSelectorLogic requires ITemplatedTerrainInfo. Current tileset is incompatible.");

Prevention

When it happens

Trigger: Opening the terrain tile selector in the map editor with a map whose tileset uses a terrain implementation that does not implement ITemplatedTerrainInfo.

Common situations: Using a custom terrain system that doesn't implement ITemplatedTerrainInfo, or loading a mod with an incompatible terrain renderer in the editor.

Related errors


AI-assisted analysis of OpenRA/OpenRA@a520984d91 (2026-08-13). Data as JSON: /api/errors/655acce7dd2022d0. Report an issue: GitHub.