So it turns out that given the complexity of the upcoming blog post and also the untimely 1.0 release of Satisfactory, that I’ve been unable to finish the blog post by the completely arbitrary deadline I’ve assigned myself. That being said, I did want to be able to put something out there in the meantime and so I’m officially launching a little side project to fill in the gaps between big, complex, and time consuming blog posts. Introducing: Godot Mini Tips!
Godot Mini Tips is going to be a series of posts where I outline simple, but powerful or useful, tips about Godot, the Godot editor, or GDScript that people might not be aware of! Over time, I collect little tidbits I find interesting and every time I need more time to work on a specific blog post, I’ll compile another few tips into a post to highlight the interesting features of this engine, it’s editor, and the language.
Today’s mini tips cover the following topics:
- Code Regions
- String Names
- Underscores in Numeric Literals
- Inline Color Picker
- Multiline Expressions
- Selecting Overlapping Nodes
Code regions
We all have those script files that just end up turning into spaghetti. You try and keep your files concise and modular, but before you know it you have a player.gd
file that is 2,000 lines of code long. Code regions won’t really help you solve that problem, but they can help you with organizing your code into more organized sections. If you have used C# before you might be familiar already with code regions. Well, starting in Godot 4.2, GDScript now supports code region folding!
To create a code region, just put #region <name of your choosing>
on the line before the area you want to section off and #endregion
on the line after your desired section of code. It should look like the following:
#region My Fancy Region
...
#endregion
Alternatively, you can also simply highlight the code you want to collapse into a region and right-click, selecting Create Code Region
.

With your region created, the Godot editor will now allow you to collapse and expand those regions to help you condense and navigate through your code!

String names
Sometimes comparing strings can be time intensive when done repeatedly. One way to avoid this is to use an enum
type. But another solution is to use StringName
. StringNames are immutable and each string name value is only ever stored once, so if you reference the same string in multiple places, they all point to the same location in memory, making it far quicker and more efficient to compare. This is Godot’s implementation of string interning. The easiest way to create a StringName
is by preceding the quoted string with an ampersand (&
).
var str = "Comparing this really long string with another really long string can take a relatively long time"
# This comparison can be really slow,
# having to compare all the characters
# each time the comparison is made
if str == "Comparing this really long string with another really long string can take a relatively long time, especially if they're similar":
print("This comparison can be really slow")
var strName = &"This comparison is quick!"
# StringName comparisons are incredibly fast by comparison
if strName == &"This comparison is quick!":
print("This comparison is quick!")
Underscores in numeric literals
This next tip is simply a quality of life improvement to help with code readability! You can add underscores (_
) to numeric literals without changing the value of the literal. This is done in some other languages to allow you to put in the thousands separator to make big numbers more readable.
var one_million = 1_000_000
Inline color picker
I recently found out about a super convenient inline color picker, built-in to the Godot editor (thanks to a post by Reddit user u/IsaqueSA). Right clicking on a color constructor, Color()
, now has an option called Pick Color
that opens up an inline color picker for you to pick your color.

Note: A follow up post would make it seem that the godot-tools VSCode extension has this feature coming soon!
Multiline expressions
If you find yourself with a really long if statement or other single line, you can split that single line into multiple lines, visually, without having to split it up into several statements on several lines. To make a line continue onto the next line, just add a backslash (\) at the end of the line you’re going to continue.

Selecting overlapping nodes
Another really annoying occurrence is when you have several nodes stacked on top of each other and having to move over to the scene tree just to click on the correct node to make adjustments to one of the nodes in the pile. Simply alt + right-click in the editor window and a popup will display listing all the nodes under your cursor for you to pick from!

GET IN THE COMMENTS!
Did you know all of these tips already? Do you think you’ll start using any of these tips? Are there any tips you think more people should know or things that took way too long for you to realize about Godot? What are your favorite quality of life features about Godot and the editor?
These are all really cool, but the inline color picker is really sick. No idea that was in there.
Ya, the color picker and layer selection are both huge, thanks for sharing!