Godot 4 @export Tips
Make Your Inspector Work for You
Every Godot developer learns @export early — slap it on a variable and it shows up in the Inspector. Done, right?
Not even close. Godot 4 ships with a family of export annotations that turn the Inspector into a full-blown editing tool: sliders, dropdowns, file pickers, color wheels, grouped panels, and bitfield selectors — all without writing a single line of plugin code.
In this Godot 4 @export tutorial, you'll learn every practical annotation with real code examples you can paste into your project today. Whether you're tweaking enemy stats, building level tools, or collaborating with a designer, these Godot export hints will save you hours of manual work. Let's dive in.
The Basics: @export and Typed Properties
The plain @export annotation exposes a variable in the Inspector. The widget Godot shows depends entirely on the variable's type — a float gets a number field, a Color gets a color picker, a Texture2D gets a resource slot.
extends CharacterBody2D
# Number field in Inspector
@export var speed: float = 200.0
# Color picker widget
@export var trail_color: Color = Color.WHITE
# Texture resource slot
@export var portrait: Texture2D
# Checkbox (bool)
@export var can_double_jump: bool = false
# Node reference picker
@export var spawn_point: Marker2DPro tip: Always add type annotations to your exports. Without them, Godot falls back to a generic Variant field — no autocomplete, no validation, and a messy Inspector.
@export_range — Sliders and Bounded Values
When you need a number within a known range, @export_range gives you a slider in the Inspector. This is one of the most used Godot export hints — it prevents invalid values and makes tuning instant.
extends CharacterBody2D
# Slider: 0 to 200, step 5
@export_range(0, 200, 5) var max_hp: float = 100.0
# Slider: 0.0 to 1.0, step 0.05
@export_range(0.0, 1.0, 0.05) var armor_reduction: float = 0.2
# Allows values outside slider range via manual typing
@export_range(0, 100, 1, "or_greater") var attack_damage: int = 25
# Degrees suffix shown in Inspector
@export_range(-180, 180, 1, "degrees") var spread_angle: float = 45.0The optional hint strings like "or_greater", "or_less", and "degrees" give you even finer control. This is especially useful when your level designer needs to tweak combat numbers without reading code. If you're building configurable enemy AI, pair this with a state machine for clean, data-driven behavior.
@export_enum — Dropdowns Without Defining an Enum
Need a quick dropdown in the Inspector without declaring a separate enum type? @export_enum is your go-to. It creates a dropdown of string or integer choices right on the variable.
extends Node2D
# Dropdown: stores the selected string
@export_enum("Friendly", "Neutral", "Hostile") var disposition: String = "Neutral"
# Dropdown: stores the index (int) instead
@export_enum("Idle", "Patrol", "Chase", "Attack") var default_state: int = 0
# Combine with an actual enum for reusable types
enum Element { FIRE, ICE, LIGHTNING, EARTH }
@export var weakness: Element = Element.FIREUse @export_enum for one-off choices. Use a proper enum when the same set of values appears in multiple scripts — Godot picks up the enum automatically and shows a dropdown in the Inspector just like @export_enum.
Want more Godot tricks?
Get our free GDScript Cheat Sheet with 20+ copy-paste snippets for signals, exports, state machines & more.
@export_flags — Multi-Select Bitfield Checkboxes
While @export_enum lets you pick one option, @export_flags lets you pick multiple. It renders checkboxes in the Inspector and stores the result as a bitmask integer. Perfect for layer assignments, ability tags, or any multi-select scenario.
extends Node
# Multi-select checkboxes in Inspector
@export_flags("Fire", "Ice", "Lightning", "Earth") var resistances: int = 0
# 2D physics layer checkboxes
@export_flags_2d_physics var collision_layers: int = 0
func is_resistant_to_fire() -> bool:
# Bit 0 = Fire (value 1)
return resistances & 1 != 0Godot also provides @export_flags_2d_render, @export_flags_3d_physics, and @export_flags_3d_render for built-in layer selections. These are huge time-savers when configuring collision and visibility layers.
@export_file & @export_dir — Path Pickers
Instead of typing file paths manually (and hoping they're correct), use @export_file and @export_dir to get native file and directory pickers in the Inspector. You can even filter by extension.
extends Node
# File picker — any file
@export_file var config_path: String
# File picker — filtered to .tscn scenes only
@export_file("*.tscn") var next_level_scene: String
# File picker — filtered to .tres resources
@export_file("*.tres") var loot_table: String
# Directory picker
@export_dir var levels_folder: StringThis is especially powerful for level designers who need to wire up scene transitions or data tables without memorizing res:// paths.
@export_multiline — Text Areas for Dialogue and Notes
By default, exported String variables show as a single-line text field. Use @export_multiline to get a resizable text area — essential for dialogue text, item descriptions, or any content that spans multiple lines.
extends CharacterBody2D
@export var npc_name: String = "Merchant"
# Multi-line text area in Inspector
@export_multiline var greeting_dialogue: String = "Welcome, traveler!"
@export_multiline var backstory: StringPair this with a dialogue system and your writers can edit NPC text directly in the Inspector without ever opening a script file. Godot makes content authoring simple.
@export_group & @export_subgroup — Organized Panels
Once you have more than a handful of exported properties, the Inspector gets cluttered. @export_group and @export_subgroup let you organize properties into collapsible panels — exactly like Godot's built-in node sections. This is one of the most underrated Godot 4 inspector customization features.
extends CharacterBody2D
@export_group("Movement")
@export var walk_speed: float = 200.0
@export var run_speed: float = 400.0
@export var jump_force: float = 600.0
@export_group("Combat")
@export_range(0, 100) var base_damage: int = 10
@export_range(0.0, 1.0, 0.01) var crit_chance: float = 0.15
@export_subgroup("Resistances")
@export_range(0.0, 1.0) var fire_resist: float = 0.0
@export_range(0.0, 1.0) var ice_resist: float = 0.0
@export_group("Visuals")
@export var sprite_color: Color = Color.WHITE
@export var glow_enabled: bool = falseThis creates three collapsible sections — Movement, Combat (with a Resistances subgroup), and Visuals — directly in the Inspector. It feels native because it is native.
Pair these @export patterns with a clean signal bus and your codebase will be 10x more maintainable. Our Mastering GDScript Signals course covers the architecture side in 15 minutes.
Exporting Arrays, Dictionaries, and Custom Resources
Godot 4 supports typed array exports, which means the Inspector knows exactly what type to expect for each element. Combined with custom Resource classes, this pattern is how you build data-driven systems — inventory items, skill trees, loot tables, and more.
class_name InventoryItem
extends Resource
@export var item_name: String
@export var icon: Texture2D
@export_range(1, 99) var stack_size: int = 1
@export_multiline var description: Stringextends Node
# Typed array — Inspector shows InventoryItem slots
@export var items: Array[InventoryItem] = []
# Typed array of packed scenes
@export var enemy_pool: Array[PackedScene] = []
# Simple typed arrays
@export var spawn_weights: Array[float] = []Custom Resources are one of the most powerful patterns in Godot 4. They let you create reusable data objects that designers can edit visually. Check our 5 GDScript Tricks article for more on class_name and static typing patterns.
Godot 4 @export Cheat Sheet
Here's a quick reference table of every export annotation covered in this tutorial. Bookmark this for your next project:
| Annotation | Inspector Widget | Best For |
|---|---|---|
@export | Auto (based on type) | Any typed property |
@export_range | Slider | Bounded numbers (HP, speed) |
@export_enum | Dropdown | Single-choice strings/ints |
@export_flags | Checkboxes | Multi-select bitmasks |
@export_file | File picker | Scene/resource paths |
@export_dir | Directory picker | Folder paths |
@export_multiline | Text area | Dialogue, descriptions |
@export_group | Collapsible panel | Organizing properties |
@export_subgroup | Nested panel | Sub-categories |
@export_color_no_alpha | Color picker (no alpha) | RGB-only colors |
@export Best Practices for Godot 4 Projects
After using every export annotation in production, here are the patterns that have served me best:
- Always use type annotations — Untyped exports become generic Variant fields. Type them and Godot picks the best widget automatically.
- Group early, group often — Start using @export_group from day one. It costs nothing and pays off the moment your script has 5+ exports.
- Use @export_range for any tunable number — Sliders make iteration 10x faster. If there's a valid range for a value, enforce it.
- Prefer custom Resources over dictionaries — A Resource with typed @export properties is always better than a raw Dictionary — you get autocomplete, validation, and reusable .tres files.
- Combine annotations freely — You can mix @export_group with @export_range, @export_enum, and other annotations. They compose naturally.
These Godot export hints transform your Inspector from a raw property dump into a designer-friendly tool. Once you start using them, you'll never go back to plain @export on everything.
Want @export, signals, shaders, state machines, and more? The Godot Pro Pack bundles all 6 courses at 50%+ off — one purchase, lifetime access.
That's every practical @export annotation in Godot 4, from basic typed properties to grouped panels and bitfield flags. Each one takes seconds to add and saves minutes (or hours) of manual tweaking every time you iterate on your game.
Start with @export_group and @export_range on your next script — they're the highest-impact changes. Then layer in enums, flags, and custom resources as your project demands them. Your future self (and your teammates) will thank you.
Get the Free GDScript Cheat Sheet + Weekly Godot Tips
Join indie devs getting our GDScript Cheat Sheet with 20+ copy-paste snippets for signals, exports, state machines, and more — plus weekly Godot tips and architecture tricks straight to your inbox.
Ready to go beyond @export? Our micro-courses cover GDScript signals, state machines, shaders, and more — each in 15 focused minutes.
Mastering GDScript Signals
Signal buses, typed signals, async patterns — the definitive signals course for Godot 4.
$4.99 · 15 min →State Machines in GDScript
Clean game logic with reusable state machines. Pair with @export for data-driven states.
$4.99 · 15 min →Godot Pro Pack Bundle
All 6 courses at a discount. Signals, shaders, state machines, multiplayer, and more.
$12.99 · Save 50%+ →Keep reading
Liked this guide? Check out How to Use the Signal Bus Pattern in Godot 4 and 5 GDScript Tricks Most Godot Devs Don't Know for more patterns. Browse all courses →