Annotation

2025/12/27

Type
Learning Resource
Format
Glossary Article
Version
General
Subject Tags
Code
Assets
All else
Copyright 2016-2026, GDQuest
Created
2026/02/16
Updated
2025/12/27

Annotation

An annotation is an extra piece of information or metadata included in code that provides the computer or the user with more information about how the code works.

In the GDScript language, annotations start with an @ sign and are used to change the behavior of the following code statement.

For example, the @onready annotation makes the initialization of a member variable run right before the _ready() function. And the @export annotation and its many variants make a property editable in the Inspector dock in the editor.

So, the following code:

@onready var label: Label = $Label

Is nearly equivalent to the following:

var label: Label = null

func _ready() -> void:
    label = $Label

The nuance is that the @onready annotation makes the initialization of the label variable run right before the _ready() function. In practice, it's the same as inserting the initialization code at the beginning of the _ready() function.

Can I create my own annotations in GDScript?

At the time of writing, Godot does not support creating custom annotations in the GDScript language. There's a proposal to add this feature, but the discussion is not settled yet.

Become an Indie Gamedev with GDQuest!

Don't stop here. Step-by-step tutorials are fun but they only take you so far.

Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.

Nathan

Founder and teacher at GDQuest
  • Starter Kit
  • Learn Gamedev from Zero
Check out GDSchool

You're welcome in our little community

Get help from peers and pros on GDQuest's Discord server!

20,000 membersJoin Server

Contribute to GDQuest's Free Library

There are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!