Free Tutorial · Godot 4 @export

Godot 4 @export Tips
Make Your Inspector Work for You

SScriptSnap/March 2026/10 min read

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 Annotations

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.

player.gd
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: Marker2D

Pro 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.

enemy_config.gd
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.0

The 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.

npc_dialogue.gd
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.FIRE

Use @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.

GDSJoin 500+ Godot devs · No spam · Unsubscribe anytime

@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.

ability_system.gd
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 != 0

Godot 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.

level_loader.gd
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: String

This 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.

npc.gd
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: String

Pair 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.

character_stats.gd
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 = false

This 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.

Take the course — $4.99 →

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.

inventory_item.gd
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: String
inventory.gd
extends 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:

AnnotationInspector WidgetBest For
@exportAuto (based on type)Any typed property
@export_rangeSliderBounded numbers (HP, speed)
@export_enumDropdownSingle-choice strings/ints
@export_flagsCheckboxesMulti-select bitmasks
@export_fileFile pickerScene/resource paths
@export_dirDirectory pickerFolder paths
@export_multilineText areaDialogue, descriptions
@export_groupCollapsible panelOrganizing properties
@export_subgroupNested panelSub-categories
@export_color_no_alphaColor 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.

Get the Pro Pack — $12.99 →
>> EOF

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.

Free download
+ weekly tips

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.

20+ GDScript snippets
Weekly Godot tips
Zero spam, cancel anytime
>
GDSJoin 500+ Godot devs. Unsubscribe in one click.