EditorSettings in Godot – Complete Guide

Managing an array of options within your game development process can often be just as demanding as the creative work itself—perhaps that’s why Godot’s EditorSettings class is such an essential part of any Godot 4 environment. This tool allows developers to tweak and finetune their project and editor settings to better fit their workflows and project needs. By learning how to effectively wield the EditorSettings class, you empower yourself to seamlessly customize your development experience, ensuring that you can stay focused on what you really love: bringing your game ideas to life.

What is EditorSettings in Godot 4?

EditorSettings is a class in Godot 4 that operates as a central hub for all settings that are global to the editor, rather than to a specific project. Everything from your debugger preferences to the appearance of the editor’s interface can be adjusted through this robust system. EditorSettings is incredibly comprehensive, encompassing a wide range of parameters that might at first seem daunting, but with the right guidance, you’ll find it to be an indispensable ally in your development process.

What is EditorSettings Used For?

Imagine ​​having a control panel that allows you to tailor the Godot editor to your personal preferences and requirements. That’s exactly what EditorSettings offers. Whether you want to set the thumbnail size in your file system dock, alter the animation editor’s behavior, or change the font size of your code editor, EditorSettings has you covered. It’s the backbone for a personalized development experience that conforms to your individual workflow.

Why Should You Learn About EditorSettings?

Understanding and utilizing the EditorSettings class is a sign of a developer’s maturity and familiarity with the Godot engine. Learning how to customize your editor can lead to a more efficient and enjoyable game development process. Furthermore, as projects grow in complexity, the ability to streamline your workflow becomes increasingly more valuable. Managing EditorSettings is a small investment in time that pays substantial dividends in productivity. Let’s embark on this journey to master the EditorSettings class together—it’s a skill that will significantly enhance your proficiency in developing games with Godot 4.

CTA Small Image
FREE COURSES AT ZENVA
LEARN GAME DEVELOPMENT, PYTHON AND MORE
ACCESS FOR FREE
AVAILABLE FOR A LIMITED TIME ONLY

Accessing and Modifying Editor Settings

Before diving into customizing your editor, you need to know how to access and modify editor settings. This section will cover how to retrieve and alter both individual and multiple settings using code within Godot 4, ensuring that you understand the fundamentals.

To access your current editor settings, you can use the get_settings method:

var settings = EditorSettings.get_settings()

Now, to modify a simple setting such as changing the editor’s theme, you might do something like this:

EditorSettings.set("interface/theme/preset", "dark")

If the change does not reflect immediately, you might need to restart the editor. In some cases, there are methods available to update the interface without a restart.

Working with Shortcuts in EditorSettings

Creating your own custom shortcuts can significantly speed up your development process. Here’s how you can manage editor shortcuts programmatically:

To add a shortcut:

var shortcut = ShortCut.new()
var input_event = InputEventKey.new()
input_event.scancode = KEY_W
shortcut.set_shortcut(input_event)
EditorSettings.set("shortcuts/3d_editor/fly_mode", shortcut)

To remove a shortcut, you can reset it to null:

EditorSettings.set("shortcuts/3d_editor/fly_mode", null)

Getting the current assigned shortcut:

var shortcut = EditorSettings.get("shortcuts/3d_editor/fly_mode")
print(shortcut.get_as_text())

Managing External Editor Settings

If you prefer using an external text editor for scripting, you’ll want to configure Godot’s settings to open script files in the editor of your choice. Here’s how to set up an external editor and ensure Godot knows to use it:

To set an external editor:

EditorSettings.set("text_editor/external/use_external_editor", true)
EditorSettings.set("text_editor/external/exec_path", "/path/to/your/editor")

And if you need to set command line flags, you can also set the exec flags setting:

EditorSettings.set("text_editor/external/exec_flags", "{file} {line}")

Adjusting Editor Layout and Element Sizes

Godot’s interface can be tweaked to suit your screen and preferences, improving readability and the usability of various panels and docks:

Changing the dock slot sizes can be done like so:

EditorSettings.set("docks/property_editor/size", 350)

If you want to work with larger or smaller script text, adjust the script text size:

EditorSettings.set("text_editor/theme/font_size", 14)

Remember that after making changes through code, you should save your editor settings. This can be done using the save_settings method:

EditorSettings.save_settings()

With these examples, you’ve learned how to access and modify the most commonly used editor settings. Now you have the knowledge to customize your Godot editor in ways that can make your development process smoother and more efficient. Stay tuned as we delve into more advanced configurations and use cases in the next part of our tutorial!

Delving deeper into customization, our next examples will help you navigate the more intricate capabilities of the EditorSettings class in Godot 4. We’ll explore how to address editor behavior, adjust network settings, and personalize sound settings to create the ultimate development habitat for your projects.

Snap and Grid Customization: Navigating the 2D or 3D workspace efficiently often necessitates a well-adjusted grid and snapping settings. Here’s how you manage those:

EditorSettings.set("editors/2d/snap/grid_step", Vector2(32, 32))
EditorSettings.set("editors/3d/snap/grid_step", 1.0)
EditorSettings.set("editors/3d/snap/rotation_degrees", 15)

Auto-Save Configurations: Prevent data loss with regular auto-saves of your project with the following settings:

EditorSettings.set("filesystem/on_save/save_external_data", true)
EditorSettings.set("filesystem/on_save/save_before_running", true)

This ensures that external resource files and scene files are saved whenever you hit the play button.

Network Settings: For multiplayer testing or for setting up external asset libraries, network configuration is key. Adjust settings like these:

EditorSettings.set("network/debug/remote_debug_host", "localhost")
EditorSettings.set("network/debug/remote_debug_port", 6016)

Audio Settings: To ensure your editor sound levels are comfortable for extended periods of work, you can control the volume like this:

EditorSettings.set("interface/editor/editor_sound_volume", 0.5)

Console Output Colors: For an easier debug process, assigning different colors to console output can help you distinguish messages quickly:

EditorSettings.set("docks/output/error_color", Color(1, 0.2, 0.2))
EditorSettings.set("docks/output/warning_color", Color(1, 1, 0.2))
EditorSettings.set("docks/output/info_color", Color(0.3, 0.65, 1))

Customizing Filesystem Favorites: Frequently accessed directories can be added to the filesystem dock as favorites for quick access:

var favorites = PoolStringArray(["res://scenes", "res://scripts"])
EditorSettings.set("filesystem/favorites", favorites)

Adding Plugins to the Editor: Godot’s extensibility through plugins is one of its most powerful features. Register your plugin to have it available within the editor like so:

EditorPlugins.add_plugin("res://path_to_your_plugin/godot_plugin.gd")

Each code example demonstrates how to programmatically customize your editor, making it behave exactly how you need it to. Keep in mind, each setting’s identifier (the string path) should match precisely with the ones used within the Godot Editor itself—be sure to look up the correct identifier if you’re unsure.

Utilizing the EditorSettings class isn’t just a matter of convenience. It’s about adapting the tooling around you to suit your project needs, increasing efficiency, and ultimately, creating better games with less frustration along the way. So have fun tweaking and fine-tuning to heart’s content—with Godot 4, your editor truly is your own.

And always remember: after you have perfected your editing environment, use EditorSettings.save_settings() to make your changes permanent. Onward to more polished projects and streamlined workflows!

Perfecting your Godot 4 editor environment involves diving into complex functionalities and ensuring that each aspect conforms to your unique needs. As we advance further, remember that each setting adjusted is a building block towards a more personalized and effective development experience.

Let’s explore more advanced facets of editor customization with additional code examples:

Editor Navigation Hints: Adjust how you navigate through scripts and scenes:

EditorSettings.set("editors/2d/navigation/zoom_out", true)
EditorSettings.set("editors/3d/navigation/zoom_style", "vertical")

This will enable all-out zooming in the 2D editor and change the 3D editor’s zoom style to a vertical motion.

Editor History Length: Customize the undo/redo history length to match your workflow:

EditorSettings.set("editors/@globals/undo_history_size", 100)

With this, you’ve expanded your project’s history capacity. This allows you to undo or redo up to 100 actions, helping to mitigate mistakes.

External Syntax Coloring: Define external syntax highlighting rules for different file types:

EditorSettings.set("text_editor/syntax_highlighting/custom_theme", "res://path_to_your_custom_theme.tres")

Now your editor will apply your custom syntax highlighting theme to all script files, improving readability based on your preference.

Editor Feature Profiles: Toggle feature sets on and off depending on your current needs:

EditorSettings.set("interface/editor/feature_profile", "Mobile")

This will switch the editor to a profile optimized for mobile development, decluttering your workflow.

Furthermore, if you’re engaged in developing AR or VR applications, knowing how to adjust the editor settings relevant to your immersive environments is essential. Here are some examples to get started with:

EditorSettings.set("editors/3d/navigation_scheme", "OpenVR")
EditorSettings.set("editors/3d/warped_navigation", true)

These changes will apply navigation schemes and settings more favorable to VR development environments.

Adjusting the Script Editor Appearance allows for a more comfortable coding experience, especially during those long coding sessions:

EditorSettings.set("text_editor/theme/color_scheme", "Custom")
EditorSettings.set("text_editor/highlighting/brace_mismatch_color", Color(1, 0, 0))
EditorSettings.set("text_editor/highlighting/current_line_color", Color(0.3, 0.3, 0.3))

This configures the script editor to highlight brace mismatches and the current line, reducing errors and improving code navigation.

Remember, preferences vary from one developer to another, and sometimes, even between different projects. The freedom to finely adjust your working environment can make a significant difference in productivity and development enjoyment. Although the examples provided above scratch the surface of what’s possible with Godot 4’s EditorSettings, they serve as a gateway to exploring deeper personalization. After making your desired changes, invoking EditorSettings.save_settings() will ensure your environment remains exactly as you need it. Happy coding, and may your editor environment be as unique and creative as the games you develop!

Furthering Your Game Development Journey

Having explored the depths of EditorSettings within Godot 4, you’ve equipped yourself with the knowledge to tailor your development environment to your exact needs. But don’t let your learning journey end here. To continue expanding your game development skill set, consider diving into our Godot Game Development Mini-Degree. This comprehensive program is structured to usher you from the basics of Godot 4 to the more intricate processes of building full-fledged games across various genres. Whether you’re just starting out or looking to polish your skills, these courses offer the flexibility to learn at your own pace with the guidance of experienced instructors.

At Zenva, we are committed to providing a diverse array of content that caters to learners at different stages of their coding and game development journey. Should you seek to broaden your horizons beyond the specifics of Godot, our collection of game development courses, including a rich selection centered around the Godot engine, awaits you. Discover more by visiting our Godot courses, where new vistas of learning are just a click away. Keep building, keep learning, and continue to bring your game ideas to life with the skills you acquire with us, here at Zenva.

Conclusion

In the realm of game development, the tools at your disposal can be as crucial as your creative vision. Godot 4’s EditorSettings is a testament to the engine’s commitment to versatility and user control. From customizing your shortcuts to fine-tuning your editor’s layout, mastering these settings is akin to sharpening your sword before a battle—it equips you with precision and preparedness that can significantly elevate your game development prowess.

As you continue to mold and adapt your editor environment to your workflow, remember that continuous learning is the cornerstone of success in game development. Harness the power of our Godot Game Development Mini-Degree to take that next big leap forward. With a world of knowledge at your fingertips, there’s no limit to what you can achieve. So keep pushing boundaries, keep exploring, and let Zenva be the catalyst that propels you to new heights in your game development journey.

FREE COURSES
Python Blog Image

FINAL DAYS: Unlock coding courses in Unity, Godot, Unreal, Python and more.