Editor UI Hierarchy
The level editor UI is structured as a tree of SleekFullscreenBox containers, each representing a major editor mode: level settings, terrain editing, object placement, spawn points, environment properties, navigation, and volumes. The EditorUI singleton manages the top-level message and hint display, while individual tool panels manage their own widget trees.
Source code location: Unturned/Edit/EditorUI.cs, EditorSelection.cs, UI/Edit/EditorDashboardUI.cs, EditorLevelUI.cs, EditorTerrainUI.cs, EditorSpawnsUI.cs, EditorEnvironmentUI.cs
EditorUI — Top-Level Controller
EditorUI is a MonoBehaviour singleton (instance) that manages global editor UI state:
Message system: The message(EEditorMessage) method displays contextual hints based on the active editor tool. Messages are shown for HEIGHTS, ROADS, NAVIGATION, OBJECTS, NODES, and VISIBILITY modes, each rendering a localized string with relevant key bindings:
csharp
public static void message(EEditorMessage message)
{
if (!OptionsSettings.hints) return;
messageBox.IsVisible = true;
if (message == EEditorMessage.HEIGHTS)
messageBox.Text = EditorDashboardUI.localization.format("Heights", ControlsSettings.tool_2);
// ...
}Messages persist for MESSAGE_TIME (2 seconds). During a message, the hint system is suppressed.
Hint system: The hint(EEditorMessage, string) method overlays a non-dismissing hint. Only one hint type is supported (FOCUS), which shows an arbitrary string. Hints are overridden when a message is active (isMessaged guard).
csharp
public static void hint(EEditorMessage message, string text)
{
if (!isMessaged)
{
messageBox.IsVisible = true;
if (message == EEditorMessage.FOCUS)
messageBox.Text = text;
}
}EditorSelection — Transform Snapshot
EditorSelection is a lightweight data class that captures a transform's complete state at the moment of selection:
csharp
public class EditorSelection
{
public Transform transform { get; private set; }
public Vector3 fromPosition;
public Quaternion fromRotation;
public Vector3 fromScale;
public Matrix4x4 relativeToPivot;
}The EditorObjects system maintains a List<EditorSelection> as its active selection set. Each selection stores the original transform values, enabling the undo system to revert transform changes. The relativeToPivot matrix provides a local-coordinate reference for multi-object manipulation.
Access methods:
GetMostRecentSelectedGameObject()— returns the last-selected game objectEnumerateSelectedGameObjects()— iterates the selection
Panel Hierarchy
The editor UI is organized as a stack of SleekFullscreenBox panels, each toggled by the editor dashboard:
EditorDashboardUI
├── EditorLevelUI
│ ├── EditorLevelObjectsUI
│ ├── EditorLevelVisibilityUI
│ ├── EditorLevelPlayersUI
│ └── EditorVolumesUI
├── EditorTerrainUI
│ ├── EditorTerrainHeightUI (heightV2)
│ ├── EditorTerrainMaterialsUI (materialsV2)
│ ├── EditorTerrainDetailsUI (detailsV2)
│ └── EditorTerrainTilesUI (tiles)
├── EditorSpawnsUI
│ ├── EditorSpawnsItemsUI
│ ├── EditorSpawnsPlayersUI
│ ├── EditorSpawnsZombiesUI
│ ├── EditorSpawnsVehiclesUI
│ └── EditorSpawnsAnimalsUI
├── EditorEnvironmentUI
│ ├── EditorEnvironmentLightingUI
│ ├── EditorEnvironmentNavigationUI
│ ├── EditorEnvironmentRoadsUI
│ └── EditorEnvironmentNodesUI
└── EditorPauseUIEach panel follows the same pattern: a container (SleekFullscreenBox), an active boolean, and open()/close() methods that animate the container in or out of view:
csharp
public static void open()
{
if (active) return;
active = true;
container.AnimateIntoView();
}
public static void close()
{
if (!active) return;
active = false;
// Close sub-panels
container.AnimateOutOfView(1, 0);
}Tab switching within a panel closes all sub-tabs then opens the selected one:
csharp
private void onClickedObjectsButton(ISleekElement button)
{
EditorLevelObjectsUI.open();
EditorLevelVisibilityUI.close();
EditorLevelPlayersUI.close();
volumesUI.Close();
}EditorDashboardUI — Mode Selection
The dashboard is the toolbar at the top of the editor screen. It provides buttons that toggle between major editor modes. Each mode button in the dashboard opens the corresponding panel and closes all others. The dashboard also owns the localization instance used by the message system.
Editor Level, Terrain, Spawns, and Environment Panels
Each major panel group contains mode-specific sub-panels:
- Level (
EditorLevelUI) — buttons for Objects, Visibility, Players, and Volumes tabs - Terrain (
EditorTerrainUI) — buttons for Heights, Materials, Details (foliage), and Tiles tabs, plus helper methodsGoToHeightsTab(),GoToMaterialsTab(),GoToFoliageTab(),GoToTilesTab() - Spawns (
EditorSpawnsUI) — per-type spawn editors for items, players, zombies, vehicles, and animals - Environment (
EditorEnvironmentUI) — lighting, navigation, roads, and nodes editors
All panels extend SleekFullscreenBox and follow the same lifecycle: open() / close() / OnDestroy(). Sub-panels are instantiated as member fields in the parent panel and are toggled via Open() / Close() methods from the base SleekFullscreenBox.
