Export Variables
Expose script variables to the Inspector for easy tweaking and level design.
Scripting
No shortcutBeginner5 min readQuick Reference
Export Variables
Godot EngineKeyboard Shortcut
N/A
Where to Find
Select any node → Click Attach Script button, or Script Editor panel
Best Used For
- ▸Write game logic with variables and functions
- ▸Connect nodes via signals for decoupled systems
- ▸Expose Inspector properties for designer tweaking
Beginner-Friendly⏱ 15–30 minutes to master
Key Settings
Basic export:Ranges:Enums:Colors:
Export variables let you expose script properties to the Inspector, making them editable without modifying code. Essential for level designers and artists.
Where to Find It
Add @export before any variable declaration in GDScript. The variable appears in the Inspector when the node is selected.
How to Use
- Basic export:
@export var speed: int = 300. - Ranges:
@export_range(0, 100, 1) var volume: int = 50. - Enums:
@export_enum("Walk", "Run", "Sprint") var mode: String. - Colors:
@export var tint: Color = Color.WHITE. - Nodes:
@export var player: NodePathto reference other nodes.
Pro Tips
- Use
@export_group("Combat")to organize exported variables in Inspector sections. - Use
@export_multilinefor multi-line string inputs. - Use
@export_tooltip("Speed in pixels/sec")for descriptive tooltips.