Skip to content

Game.UI.Editor.EditorTerrainTool

Assembly:
Assembly-CSharp (typical for Cities: Skylines 2 mod assemblies; adjust if your project places this type in a different assembly)
{{ This class is part of the game's UI/editor code and will normally be found in the primary runtime assembly. }}

Namespace:
Game.UI.Editor
{{ Contains editor UI tools related to the in-game editor/terrain editing tools. }}

Type:
class
{{ A concrete, non-generic class implementing a specific editor tool. }}

Base:
EditorTool
{{ Inherits common functionality from EditorTool (ID, UI tagging, icon, panel reference and any registration/activation behavior provided there). }}

Summary:
Represents the terrain editing tool used by the in-game editor. The constructor configures the tool's identifier, UI tag, icon and associates it with the TerrainPanelSystem for the editor UI.
{{ Use this class when you need a ready-made terrain tool in the editor UI or as a reference when implementing custom editor tools that must integrate with the same panel/system. }}


Fields

  • public const string kToolId
    Constant value: "TerrainTool"
    {{ Public constant string that identifies the tool. This can be used by other systems to reference the terrain tool by id. Unlike instance fields, it is compile-time constant and shared across uses. }}

Properties

  • No properties declared on this class.
    {{ The class relies on properties defined in the base EditorTool (for example id, uiTag, icon, panel). The constructor sets those base properties. If you need additional state, extend this class and add properties as needed. }}

Constructors

  • public EditorTerrainTool(World world)
    {{ Initializes a new instance of EditorTerrainTool. The constructor calls the base EditorTool constructor with the provided World, then sets up identifying and UI information:
  • base.id = "TerrainTool" (tool identifier)
  • base.uiTag = "UITagPrefab:ModifyTerrainButton" (used to locate or create the corresponding UI button/prefab)
  • base.icon = "Media/Editor/Terrain.svg" (path to the tool icon)
  • base.panel = world.GetOrCreateSystemManaged() (associates the tool with the TerrainPanelSystem for terrain editing UI)

Note: World is from Unity.Entities (DOTS). GetOrCreateSystemManaged() ensures the TerrainPanelSystem exists in the provided World and assigns it to the tool's panel reference. Ensure the World you pass is the editor/game world where UI systems live. }}

Methods

  • No methods declared on this class.
    {{ All runtime behavior (activation, input handling, UI interactions) is expected to be handled by the base EditorTool and the associated TerrainPanelSystem. If you need custom behavior on activation or update, derive from EditorTerrainTool (or from EditorTool) and override/extend the relevant lifecycle methods from the base class. }}

Usage Example

// Create and configure the terrain tool (example within editor initialization code)
World world = /* obtain the World instance for the editor, e.g. World.DefaultGameObjectInjectionWorld */;
var terrainTool = new Editor.UI.EditorTerrainTool(world);

// Alternatively, if you extend it:
public class MyCustomTerrainTool : Editor.UI.EditorTerrainTool
{
    public MyCustomTerrainTool(World world) : base(world)
    {
        // custom initialization
    }

    // override base lifecycle methods here if EditorTool exposes them
}

{{ Typical usage is to construct the tool with the appropriate World so it can acquire the TerrainPanelSystem. If you need to register tools with a tool manager or toolbar, do so after construction according to the project's tool-registration flow. }}