There’s an essential resource we kept hidden from you all that time. It’s the bible that every professional developer uses: the code reference.
While it’s an essential tool, using the code reference efficiently requires some programming experience as it is full of programmer jargon. You have learned just enough to make the most of it by now.
The code reference is a technical reference of all the functions, properties, and classes available in a given code library.
In programming, we call all these names (functions, properties, class names, etc.) symbols. We will use that term in this lesson to avoid some repetition.
A code reference contains descriptions for each symbol. They’re presented like this.
Godot has one of the most convenient code references you’ll find out there. It’s integrated into the editor, and you can search it anytime by pressing F1.
You can use it to:
Even as a professional, it’s completely normal to forget about functions, syntax, you name it. There are over a hundred nodes and thousands of functions in Godot. You can’t just know everything by heart!
Developers use the code reference constantly to review functions we have forgotten many times already.
Let’s see how to use it.
To get started, press F1 to open the help search popup and search for “area.” This filters the list down to the symbols (names of nodes, properties, functions, etc.) that contain the word “area” in white.
It highlights the 3D
node because it perfectly matches our search term.Scroll to the top of the window using the mouse wheel and click the little arrow to the left of
to fold all the information about 3D nodes. We only want to look at the 2D ones here.Notice how each line has a different indentation, creating a visual hierarchy.
In grey, you have all the classes that the symbols in white extend
from. If we look at CollisionObject2D
, , and so on, all the way up to .
It means that CollisionObject2D
, , etc.
It’s important because when we open the
reference page, it will only list the unique symbols of . But to find everything the node can do, you will also have to browse the parent classes.Before we open the
page, notice that you can see the category of each symbol on the right side, whether it’s a class, a property, a method (function), etc.Now, please double-click on
to open its page.This opens the code reference page in the script editor.
Every code reference page has the same structure.
At the top, you find the classes that this node inherits from (extends). You can click each node type to jump to the corresponding reference page.
Then, you get a short description followed by a long one.
If you scroll down, you may get some links to the official manual, followed by the node’s properties, methods (functions), signals, and enumerations (lists of constants).
This section is the reference page’s table of contents. Keep scrolling to get the actual description of each function and property.
Please scroll down a bit and in the Methods section, click
on get_overlapping_areas()
.
Each function description starts with the return value type.
If it is void
, like for _process()
, the
function does not return any value.
Then, you have the function name followed by each of its arguments
and the type of each argument inside parentheses. Here’s an example with
the Area2D.overlaps_area()
function.
After that, you might see either const
or
virtual
in grey.
The word const
means it’s a regular function, while
virtual
means that it is designed for you to override in
your scripts. If you press F1, look for “node,” and open the
class page, you will see it has many virtual
functions like _process()
, _unhandled_input()
,
etc.
The documentation of variables is similar. They start with the type followed by the name.
Then, there’s the default value, which you can also see when creating a node of that type in a scene, thanks to the Inspector.
Below that, you will also see two functions starting with the words “get” and “set.”
In Godot, while you generally work with the names of the built-in variables directly, you can also use corresponding setter and getter functions. Older versions of Godot used to work exclusively with those functions.
You can jump quickly to the main sections of a reference page using the little menu in the bottom left of the script editor. Click on any of the labels to jump to the corresponding section.
Also, you can search the page by pressing Ctrl+F. This allows you to quickly jump to some terms or find functions you don’t remember exactly.
There’s one more feature that’s super useful to browse a reference and navigate your code: control-clicking on symbols in your scripts.
When working on a script, you can jump to the definition of any symbol by pressing the Ctrl key down and clicking on it.
If you click on anything built into Godot like a function, node type, or variable, you will instantly jump to the corresponding reference page.
You can then press Alt+Left to navigate back to your script quickly.
If you control-click on a symbol that you created in your project, it will take you to that symbol’s definition.
It’s really useful to navigate code and remind yourself what a function you wrote does or where it comes from.
We use multiple terms to talk about functions in programming: functions, routines, procedures, etc. One of these is “method.”
A method is a function that is attached to an object.
An object is like a little machine that bundles variables and functions together.
In GDScript, you always work with objects. Every node is an object in Godot because it bundles variables and functions.
When we work exclusively with objects like this, we say that we use an approach to code called object-oriented programming.
It’s the most common approach used in video games today, but it’s also widespread in other computer software industries.
Anyway, the difference between the terms “method” and “function” is that “function” is general while “method” is specific to objects.
In GDScript, we use the terms interchangeably. While there are
built-in functions like lerp
or clamp
, the
majority of our code will be using object’s methods, and everything we
write ourselves will be in objects.
In other programming languages, like C++ or JavaScript, you can write functions that exist outside of objects. In those cases, developers do not call them methods.
We don’t like jargon too much at GDQuest. We try to avoid it unless necessary. That’s why we stick to the most straightforward words like “function” or “variable” in the course.
However, when you join online discussions with experienced programmers or buy books about programming to learn more, you will see technical terms everywhere.
In many programming resources or communities, people use specific programming terms, even when talking to beginners.
Yet, you find some valuable insights to keep growing in those places. That’s why it’s important to learn about all these terms.