Hazel

The Code Editor

The Code Editor is where you write your game's Rust scripts, shaders and UI templates without leaving Renzora. It sits as a tab beside the Viewport in the Scene workspace, and fills the middle of the Scripting workspace.

The Scripting workspace with a Rust script open in the Code Editor

To learn how scripts work, see Rust scripts.

Opening files

  • Double-click a script or shader in the Assets panel.
  • Right-click a file and choose Open in Code Editor.
  • Drag a file from the Assets panel onto the Code Editor.

Each open file gets a tab along the top. A dot on a tab means it has unsaved changes. Press Ctrl+S to save.

Following the selection

When you select an object, the Code Editor shows that object's scripts and UI templates as its tabs, so the code you are working on always matches the object you picked. Tabs with unsaved changes stay open when you switch.

The toolbar

ButtonWhat it does
- / +Make the text smaller or bigger (Ctrl+- and Ctrl+=; Ctrl+0 resets)
WhitespaceShow spaces and tabs as faint marks
Word WrapWrap long lines to the panel's width instead of scrolling sideways
CompileShown for shader files: save and rebuild the shader straight away

Writing code

The editor helps as you type:

  • Colours for Rust, shaders (.wgsl, .wesl, .glsl), .toml, .json, .html, .sql, shell scripts and Renzora scenes (.bsn).
  • Brackets and quotes close themselves when you type the opening one.
  • New lines keep their indent.
  • Folding: click the arrow beside a block's first line to hide it.
  • Typing in other languages through your system's input method works, including Chinese, Japanese and Korean.
ToPress
Comment or uncomment linesCtrl+/
Delete the lineCtrl+Shift+K
Move the line up or downAlt+Up / Alt+Down
Duplicate the lineAlt+Shift+Up / Alt+Shift+Down
Undo / redoCtrl+Z / Ctrl+Y (or Ctrl+Shift+Z)

The full list is on the Shortcuts page.

Saving

Saving a Rust script rebuilds it in the background, so you can keep working. If you press Play while a script is still building, Play waits for it, and the status bar shows Compiling with the file's name.

Problems

The Problems panel lists errors in your scripts. Click a row to jump to the file and line. In the Scripting workspace it sits under the Hierarchy, beside the Console.

Code Editor settings

Under Settings > Scripting, in the Code Editor section:

SettingWhat it does
Auto-close pairsClose brackets and quotes as you type the opening one
Trim on saveRemove spaces at the ends of lines when you save
Whitespace markersShow spaces and tabs
Word WrapWrap long lines

The fonts are set under Settings > Appearance > Interface (Code Font), and the code colours are part of the theme (Syntax Tokens, see Settings).