|
1 | | -:article_outdated: True |
2 | | - |
3 | 1 | .. _doc_project_settings: |
4 | 2 |
|
5 | 3 | Project Settings |
6 | 4 | ================ |
7 | 5 |
|
8 | | -This page explains how to use the Project Settings window. If you would like to access and modify project settings via code, see :ref:`ProjectSettings <class_ProjectSettings>`. |
| 6 | +There are dozens of settings you can change to control a project's execution, |
| 7 | +including physics, rendering, and windowing settings. These settings can be |
| 8 | +changed from the **Project Settings** window, from code, or by manually editing |
| 9 | +the ``project.godot`` file. You can see a full list of settings in the |
| 10 | +:ref:`ProjectSettings <class_ProjectSettings>` class. |
| 11 | + |
| 12 | +Internally, Godot stores the settings for a project in a ``project.godot`` file, |
| 13 | +a plain text file in INI format. While this is human-readable and version control |
| 14 | +friendly, it's not the most convenient to edit. For that reason, the |
| 15 | +**Project Settings** window is available to edit these settings. To open the |
| 16 | +Project Settings, select **Project > Project Settings** from the main menu. |
| 17 | + |
| 18 | +.. figure:: img/project_settings_basic.webp |
| 19 | + :align: center |
| 20 | + |
| 21 | + The Project Settings window |
| 22 | + |
| 23 | +The **Project Settings** window is mainly used to change settings in the |
| 24 | +**General** tab. Additionally, there are tabs for the |
| 25 | +:ref:`Input Map <doc_input_examples_input_map>`, |
| 26 | +:ref:`Localization <doc_internationalizing_games>`, |
| 27 | +:ref:`Globals <doc_singletons_autoload>`, |
| 28 | +:ref:`Plugins <doc_installing_plugins_enabling_a_plugin>`, and |
| 29 | +**Import Defaults**. Usage of these other tabs is documented elsewhere. |
| 30 | + |
| 31 | +Changing project settings |
| 32 | +------------------------- |
| 33 | + |
| 34 | +The **General** tab of the project settings window works much like the inspector. |
| 35 | +It displays a list of project settings which you can change, just like inspector |
| 36 | +properties. There is a list of categories on the left, which you can use to select |
| 37 | +related groups of settings. You can also search for a specific setting with the |
| 38 | +**Filter Settings** field. |
| 39 | + |
| 40 | +Each setting has a default value. Settings can be reset to their default values |
| 41 | +by clicking the circular arrow **Reset** button next to each property. |
| 42 | + |
| 43 | +Changing project settings from code |
| 44 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 45 | + |
| 46 | +You can use :ref:`set_setting() <class_ProjectSettings_method_set_setting>` to |
| 47 | +change a setting's value from code: |
| 48 | + |
| 49 | +.. tabs:: |
| 50 | + .. code-tab:: gdscript GDScript |
| 51 | + |
| 52 | + ProjectSettings.set_setting("application/run/max_fps", 60) |
| 53 | + ProjectSettings.set_setting("display/window/size/mode", DisplayServer.WINDOW_MODE_WINDOWED) |
| 54 | + |
| 55 | + .. code-tab:: csharp |
| 56 | + |
| 57 | + ProjectSettings.SetSetting("application/run/max_fps", 60); |
| 58 | + ProjectSettings.SetSetting("display/window/size/mode", (int)DisplayServer.WindowMode.Windowed); |
| 59 | + |
| 60 | +However, many project settings are only read once when the game starts. After |
| 61 | +that, changing the setting with ``set_setting()`` will have no effect. Instead, |
| 62 | +most settings have a corresponding property or method on a runtime class like |
| 63 | +:ref:`Engine <class_Engine>` or :ref:`DisplayServer <class_DisplayServer>`: |
| 64 | + |
| 65 | +.. tabs:: |
| 66 | + .. code-tab:: gdscript GDScript |
| 67 | + |
| 68 | + Engine.max_fps = 60 |
| 69 | + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) |
| 70 | + |
| 71 | + .. code-tab:: csharp |
| 72 | + |
| 73 | + Engine.MaxFps = 60; |
| 74 | + DisplayServer.WindowSetMode(DisplayServer.WindowMode.Windowed); |
| 75 | + |
| 76 | +In general, project settings are duplicated at runtime in the |
| 77 | +:ref:`Engine <class_Engine>`, :ref:`PhysicsServer2D <class_PhysicsServer2D>`, |
| 78 | +:ref:`PhysicsServer3D <class_PhysicsServer3D>`, |
| 79 | +:ref:`RenderingServer <class_RenderingServer>`, |
| 80 | +:ref:`Viewport <class_Viewport>`, or :ref:`Window <class_Window>` classes. In the |
| 81 | +:ref:`ProjectSettings <class_ProjectSettings>` class reference, settings |
| 82 | +links to their equivalent runtime property or method. |
| 83 | + |
| 84 | +Reading project settings |
| 85 | +------------------------ |
| 86 | + |
| 87 | +You can read project settings with |
| 88 | +:ref:`get_setting() <class_ProjectSettings_method_get_setting>` or |
| 89 | +:ref:`get_setting_with_override() <class_ProjectSettings_method_get_setting_with_override>`: |
| 90 | + |
| 91 | +.. tabs:: |
| 92 | + .. code-tab:: gdscript GDScript |
| 93 | + |
| 94 | + var max_fps = ProjectSettings.get_setting("application/run/max_fps") |
| 95 | + var window_mode = ProjectSettings.get_setting("display/window/size/mode") |
| 96 | + |
| 97 | + .. code-tab:: csharp |
| 98 | + |
| 99 | + int maxFps = (int)ProjectSettings.GetSetting("application/run/max_fps"); |
| 100 | + var windowMode = (DisplayServer.WindowMode)(int)ProjectSettings.GetSetting("display/window/size/mode"); |
| 101 | + |
| 102 | +Since many project settings are only read once at startup, the value in the |
| 103 | +project settings may no longer be accurate. In these cases, it's better to read |
| 104 | +the value from the runtime equivalent property or method: |
| 105 | + |
| 106 | +.. tabs:: |
| 107 | + .. code-tab:: gdscript GDScript |
| 108 | + |
| 109 | + var max_fps = Engine.max_fps |
| 110 | + var window_mode = DisplayServer.window_get_mode() |
| 111 | + |
| 112 | + .. code-tab:: csharp |
| 113 | + |
| 114 | + int maxFps = Engine.MaxFps; |
| 115 | + DisplayServer.WindowMode windowMode = DisplayServer.WindowGetMode(); |
| 116 | + |
| 117 | +Manually editing project.godot |
| 118 | +------------------------------ |
| 119 | + |
| 120 | +You can open the ``project.godot`` file using a text editor and manually |
| 121 | +change project settings. Note that if the ``project.godot`` file does not have a |
| 122 | +stored value for a particular setting, it is implicitly the default value of |
| 123 | +that setting. This means that if you are are manually editing the file, you may |
| 124 | +have to write in both the setting name *and* the value. |
| 125 | + |
| 126 | +In general, it is recommended to use the Project Settings window rather than |
| 127 | +manually edit ``project.godot``. |
9 | 128 |
|
10 | | -Godot stores the project settings in a project.godot file, a plain text file in INI format. There are dozens of settings you can change to control a project's execution. To simplify this process, Godot provides a project settings dialog, which acts as a front-end to editing a project.godot file. |
| 129 | +Advanced project settings |
| 130 | +------------------------- |
11 | 131 |
|
12 | | -To access that dialog, select Project -> Project Settings. |
| 132 | +.. figure:: img/project_settings_advanced.webp |
| 133 | + :align: center |
13 | 134 |
|
14 | | -Once the window opens, let's select a main scene. Locate the `Application/Run/Main Scene` property and click on it to select 'hello.tscn'. |
| 135 | + The advanced project settings |
15 | 136 |
|
16 | | -The project settings dialog provides a lot of options that can be saved to a project.godot file and shows their default values. If you change a value, a tick appears to the left of its name. This means that the property will be saved in the project.godot file and remembered. |
| 137 | +By default, only some project settings are shown. To see all the project |
| 138 | +settings, enable the **Advanced Settings** toggle. |
0 commit comments