Skip to content

ProjectSettings: set_initial_value makes custom setting unavailabe runtime #108153

Open
@PanHoracy

Description

@PanHoracy

Tested versions

Tested in:

System information

Godot v4.4.1.stable - Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU (NVIDIA; 32.0.15.7247) - AMD Ryzen 9 7945HX with Radeon Graphics (32 threads)

Issue description

I'm creating a plugin and want to expose plugin options through project settings. I wanted to give each option an initial value using set_initial_value method that is exposed in ProjectSettings. When I did that, I noticed that values set that way are unavailable during runtime. When using those settings through a tool script, in editor, everything works fine, but If I try to access them in autoload, when the game is running, get_setting is always returning null.

Steps to reproduce

  1. Create a custom option through code and set its initial value through set_initial_value
  2. Try to access those settings using get_setting at runtime (for example in _ready)

Minimal reproduction project (MRP)

This project contains:

  • Tool button for creating settings (first has initial value set, second does not)
  • Tool button for printing values of created settings (should print values of both)
  • _ready override, which prints values of created settings

project_settings_bug_minimal.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions