DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Godot 4 ConfigFile Settings: Save Volume, Fullscreen, and Keybind Preferences

Use Godot 4 ConfigFile to save player preferences, load fallbacks safely, and apply changes through runtime APIs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Godot’s ConfigFile to store player preferences in user://, load them with safe defaults at startup, apply them through the relevant runtime APIs, and save after changes. The file stores values; it does not automatically change audio, display, or input behavior.

What ConfigFile does—and does not do

ConfigFile stores Variant values under section and property names in a Godot-specific, INI-style format. A path such as user://settings.cfg is appropriate for player-specific runtime data. The official Godot 4.5 ConfigFile reference documents the format and methods.

As an Amazon Associate I earn from qualifying purchases.

Keep persistence and application as separate jobs: read a preference from the file, then call the API that changes the running game. For example, saving a fullscreen choice does not itself switch the window to fullscreen.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create a settings helper and define defaults

A small game can keep the settings logic in a node that lives for the necessary duration. If multiple scenes need access to preferences, an autoload can provide a shared owner. That is an organizational choice, not a requirement of ConfigFile.

#1 Best Overall
8Bitdo Ultimate 2C Wireless Controller for Windows PC and Android, with 1000 Hz Polling Rate, Hall Effect Joysticks and Triggers, and Remappable L4/R4 Bumpers (Green)
  • Compatible with Windows and Android.
  • 1000Hz Polling Rate (for 2.4G and wired connection)
  • Hall Effect joysticks and Hall triggers. Wear-resistant metal joystick rings.
  • Extra R4/L4 bumpers. Custom button mapping without using software. Turbo function.
  • Refined bumpers and D-pad. Light but tactile.

Choose explicit defaults in code so a first launch, missing key, or unreadable file does not leave a preference undefined. The following helper loads one configuration and returns defaults when the file cannot be loaded:

extends Node

const SETTINGS_PATH := "user://settings.cfg"

var config := ConfigFile.new()

func _ready() -> void:
    var err := config.load(SETTINGS_PATH)
    if err != OK:
        config = ConfigFile.new()

func get_setting(section: String, key: String, default_value: Variant) -> Variant:
    return config.get_value(section, key, default_value)

func set_setting(section: String, key: String, value: Variant) -> Error:
    config.set_value(section, key, value)
    return config.save(SETTINGS_PATH)

get_value(section, key, default) supplies the fallback when a property is absent. Checking load() matters because a missing or unreadable file is not evidence that saved preferences were recovered; for ordinary preferences, starting with defaults is usually the sensible fallback. The methods and error-code behavior are documented in the ConfigFile class reference.

Load preferences and apply them at startup

After the helper loads, read each preference using a default, then apply it to the relevant runtime system. Keep the stored representation consistent with the UI and your application code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
ManbaOne Interactive Screen Wireless Gaming Controller (Black)
  • Supported Multi-Platform:Switch/Switch 2 (NO support wake-up function)/iOS/Android/Windows PC (Notice:Not compatible with Xbox, PlayStation or GeForce Now, For game platforms not mentioned, please consult customer service before buying)
  • Connection modes:Wired/Bluetooth/Wireless Dongle(Connect to PC via Bluetooth : Select iOS (phone) mode, but it's not recommended; Dongle is more stable)
  • 【Innovative Intelligent Interactive Screen】Manba One V2 wireless game controllers create a new era of controller screens; Equipped with a 2-inch display, no App & software needed, you can set the pc controller directly through the screen visualization, More convenient operation
  • 【Micro Switch Button】Manba One wireless controller has Micro Switch Button and ALPS Bumper; The 6-axis gyroscope function makes switch games more immersive
  • 【Customize Your Own Controller】The intelligent interactive screen allows you to easily set vibrations, buttons, joysticks,lights, etc., without the need for complex key combinations; 4 configurations can be saved to unlock your own gameplay for different games; The 4 back keys support macro definition settings, and you can activate the set character's ultimate move with one click
var master_volume := float(settings.get_setting("audio", "master_volume", 0.8))
var fullscreen := bool(settings.get_setting("display", "fullscreen", false))

# Apply master_volume through the audio system your game uses.
# Apply fullscreen through DisplayServer at runtime.

This snippet demonstrates loading and fallback only; it deliberately does not claim to implement audio or input APIs. For display settings, Godot distinguishes settings read at startup from changes made while the game is running. The Project Settings guide points to runtime APIs for live changes, and the Godot 4.2 ProjectSettings reference shows DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) as a window-mode example.

Save when the player changes a preference

set_value() changes the in-memory object only. Call save() to write the changed data to disk; the ConfigFile reference explicitly notes that mutating the object does not itself persist it.

func on_fullscreen_toggled(enabled: bool) -> void:
    settings.config.set_value("display", "fullscreen", enabled)

    var mode := DisplayServer.WINDOW_MODE_FULLSCREEN if enabled 
        else DisplayServer.WINDOW_MODE_WINDOWED
    DisplayServer.window_set_mode(mode)

    var err := settings.config.save(SETTINGS_PATH)
    if err != OK:
        push_error("Could not save settings: %s" % error_string(err))

For a small settings file, saving each change keeps the disk copy current and makes the save point straightforward. Alternatively, update the in-memory values as the player edits and save once when the settings menu closes; that reduces writes but means an interruption before the save can lose the latest edits. Whichever approach you choose, check the returned error and do not tell the player a change was saved when the write failed.

Rank #3
GameSir G7 Pro Wired Controller for Xbox Series X|S, Xbox One, Wireless Gamepad for PC&Android with TMR Sticks, Hall Effect Analog Triggers, 1000Hz Polling Rate, 3.5mm Audio Jack - Black
  • Tri-mode Connectivity: Wired for Xbox, 2.4G & Wired for PC, and Bluetooth for Android. The G7 Pro supports seamless connectivity across Xbox, PC, and Android. Effortlessly switch between modes using the convenient physical mode switch.
  • TMR Sticks: The G7 Pro features GameSir's Mag-Res TMR sticks, combining Hall Effect durability with traditional potentiometer performance. This advanced technology delivers stable polling rates for smooth, drift-free gaming with low power consumption.
  • Hall Effect Analog Triggers: The GameSir precision-tuned Hall Effect analog triggers provide unmatched smoothness and linear input for precise control. Featuring clicky Micro Switch trigger stops, gamers can easily switch based on their preferences.
  • 1000Hz Polling Rate on PC: Experience ultra-responsive gaming with a 1000Hz polling rate on PC, available through both wired and 2.4G wireless connections. This ensures instantaneous input registration, reducing lag and optimizing your performance for the most competitive gameplay.
  • GameSir Nexus App: The G7 Pro is compatible with the upgraded GameSir Nexus app, which brings a significant upgrade over the original. It introduces powerful new features such as gyro settings, stick curve adjustments, and button-to-mouse mapping, giving you deeper customization and more control than ever before.

Handle volume as a value plus an audio operation

Decide what the file stores—such as a linear slider value or a decibel value—and use that representation consistently when reading, applying, and saving it. The ConfigFile layer can store either as a value, but it does not convert the preference into an audio change. Apply it to the audio bus your game intends to control using the appropriate runtime audio API for the Godot version you target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Map fullscreen preference to a runtime window mode

A boolean can represent the player’s choice: true for the intended fullscreen mode and false for windowed mode. Apply the choice through DisplayServer.window_set_mode() rather than assuming that writing a value into the settings file—or changing a startup-oriented project setting—will change the live window.

Confirm the desired mode and behavior on the platforms you support. If the requested mode cannot be used on a particular platform, define a fallback, such as using windowed mode, instead of promising identical behavior everywhere.

Rank #4
GameSir Nova Lite 2 Wireless PC Controller Hall Effect Sticks
  • Multi-Platform PC Gaming Controller: Working with Switch, PC, Android, and iOS devices via Bluetooth, wired, and wireless dongle connections.
  • Hall Effect Joysticks: Delivering enhanced recentering performance for smoother control and superior anti-drift capability. Plus, with anti-friction rings.
  • 2-Way Trigger Lock: With trigger stops, gamers can toggle between short and long pull positions. Additionally, gamers can activate hair trigger mode by pressing M+LT/RT (triggers must be in the long pull position).
  • 1000Hz Polling Rate: This ensures that your inputs are registered almost instantaneously, minimizing lag and maximizing your performance during competitive play.
  • Mechanical Circular D-pad: Designed for quick reactions and accuracy in every direction, this D-pad elevates your gaming experience with superior responsiveness.

Design keybind persistence deliberately

Key rebinding is not just another scalar setting: a binding involves an action and input-event data. Decide how your game will represent each action and its events, how it will restore defaults, and what it will do if saved data is missing or unsupported. Do not assume every InputEvent can be stored as a simple value.

The Godot input tutorials index identifies input handling as its own documentation area, but does not establish a specific serialization format or set of calls. Verify the exact InputMap and InputEvent APIs against the Godot 4 minor version you use before implementing serialization and restoration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reset preferences and keep the file maintainable

To reset settings, restore the chosen defaults in memory, apply them to the running game, and save the resulting values if the reset should survive a restart. Treat a save error the same way as any other failed write: the running game may be using defaults even though the file was not updated.

Best Value
Sale
EasySMX X15 Wireless PC & Steam Gaming Controller, Hall Effect, Black
  • Platform Compatibility: This PC controller is designed for Windows PC, Steam, Switch, Android, and iOS. Xbox-style asymmetric stick layout for PC gamers. Three modes cover all your devices. Please check your device compatibility before purchase
  • Three Connection Modes: 2.4G wireless, Bluetooth, wired USB-C. PC gets native XInput/DirectInput. Switch pairs via Bluetooth, no adapter. This gaming PC controller switches devices seamlessly. Stable wireless minimizes random disconnects during gaming
  • Hall Effect Precision: Hall effect joysticks and triggers eliminate stick drift. This gaming controller for PC delivers smooth, responsive input with no dead zones. Built for FPS, racing, and action games. Long-term precision for competitive PC gaming
  • Back Buttons & Battery: Two programmable back buttons map combos and shortcuts. Textured grips with dual vibration. 1000mAh battery delivers up to 20H playtime. RGB can be turned off. A solid PC controller for gaming with custom back buttons
  • ABXY Layout Switch: Press B + Minus + Plus to swap between PC and Switch modes. Features: 1000Hz polling rate, RGB lighting, turbo. Note: designed without mic jack or gyro sensor

Section and property names in a ConfigFile cannot contain spaces. A possible layout is:


master_volume = 0.8

[display]
fullscreen = false

[input]
# Define and document your own action/event representation.

This is an example layout, not a built-in Godot schema. ConfigFile uses a Godot-specific format, and comments are lost when the file is saved again, so do not use it as a place to preserve user-authored comments.

Choose a save pattern that fits the settings owner

  • One long-lived helper: load one ConfigFile, keep it in memory, update it as settings change, and save it. This suits a shared settings owner.
  • Reload before each write: reload the file before changing a value when a short-lived helper needs to avoid replacing unrelated sections with a new empty ConfigFile. Check the load result before continuing.
  • Save each change or batch-save: choose between immediate persistence and saving when the menu closes based on whether preserving every edit is more important than avoiding a write for each adjustment.

Godot’s ConfigFile reference provides the core new(), load(), get_value(), set_value(), and save() pattern. Check signatures and runtime behavior against the documentation for your selected Godot 4 minor version when turning these patterns into a complete implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.