2
0

upgrading_to_godot_4.5.rst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. .. _doc_upgrading_to_godot_4.5:
  2. Upgrading from Godot 4.4 to Godot 4.5
  3. =====================================
  4. For most games and apps made with 4.4 it should be relatively safe to migrate to 4.5.
  5. This page intends to cover everything you need to pay attention to when migrating
  6. your project.
  7. Breaking changes
  8. ----------------
  9. If you are migrating from 4.4 to 4.5, the breaking changes listed here might
  10. affect you. Changes are grouped by areas/systems.
  11. .. warning::
  12. In order to support `new Google Play requirements`_ Android now requires
  13. targeting .NET 9 when exporting C# projects to Android, other platforms
  14. continue to use .NET 8 as the minimum required version but newer versions
  15. are supported and encouraged.
  16. If you are using C# in your project and want to export to Android, you will
  17. need to upgrade your project to .NET 9 (see `Upgrading to a new .NET version`_
  18. for instructions).
  19. This article indicates whether each breaking change affects GDScript and whether
  20. the C# breaking change is *binary compatible* or *source compatible*:
  21. - **Binary compatible** - Existing binaries will load and execute successfully without
  22. recompilation, and the run-time behavior won't change.
  23. - **Source compatible** - Source code will compile successfully without changes when
  24. upgrading Godot.
  25. Core
  26. ~~~~
  27. ======================================================================================================================== =================== ==================== ==================== ============
  28. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  29. ======================================================================================================================== =================== ==================== ==================== ============
  30. **JSONRPC**
  31. Method ``set_scope`` replaced by ``set_method`` optional parameter |❌| |✔️ with compat| |✔️ with compat| `GH-104890`_
  32. **Node**
  33. Method ``get_rpc_config`` renamed to ``get_node_rpc_config`` |❌| |✔️ with compat| |✔️ with compat| `GH-106848`_
  34. Method ``set_name`` changes ``name`` parameter type from ``String`` to ``StringName`` |✔️| |✔️ with compat| |✔️ with compat| `GH-76560`_
  35. ======================================================================================================================== =================== ==================== ==================== ============
  36. Rendering
  37. ~~~~~~~~~
  38. ======================================================================================================================== =================== ==================== ==================== ============
  39. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  40. ======================================================================================================================== =================== ==================== ==================== ============
  41. **DisplayServer**
  42. Method ``file_dialog_show`` adds a new ``parent_window_id`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-98194`_
  43. Method ``file_dialog_with_options_show`` adds a new ``parent_window_id`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-98194`_
  44. **RenderingDevice**
  45. Method ``texture_create_from_extension`` adds a new ``mipmaps`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-105570`_
  46. **RenderingServer**
  47. Method ``instance_reset_physics_interpolation`` removed |❌| |✔️ with compat| |✔️ with compat| `GH-104269`_
  48. Method ``instance_set_interpolated`` removed |❌| |✔️ with compat| |✔️ with compat| `GH-104269`_
  49. ======================================================================================================================== =================== ==================== ==================== ============
  50. .. note::
  51. In C#, the enum ``RenderingDevice.Features`` breaks compatibility because of the way the bindings generator
  52. detects the enum prefix. New members were added to the enum in `GH-103941`_ that caused the enum member
  53. ``Address`` to be renamed to ``BufferDeviceAddress``.
  54. GLTF
  55. ~~~~
  56. ======================================================================================================================== =================== ==================== ==================== ============
  57. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  58. ======================================================================================================================== =================== ==================== ==================== ============
  59. **GLTFAccessor**
  60. Property ``byte_offset`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  61. Property ``component_type`` changes type from ``int`` to ``GLTFAccessor::GLTFComponentType`` |✔️| |❌| |❌| `GH-106220`_
  62. Property ``count`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  63. Property ``sparse_count`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  64. Property ``sparse_indices_byte_offset`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  65. Property ``sparse_indices_component_type`` changes type from ``int`` to ``GLTFAccessor::GLTFComponentType`` |✔️| |❌| |❌| `GH-106220`_
  66. Property ``sparse_values_byte_offset`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  67. **GLTFBufferView**
  68. Property ``byte_length`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  69. Property ``byte_offset`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  70. Property ``byte_stride`` changes type metadata from ``int32`` to ``int64`` |✔️| |❌| |❌| `GH-106220`_
  71. ======================================================================================================================== =================== ==================== ==================== ============
  72. .. note::
  73. As a result of changing the type metadata, the C# bindings changed the type from ``int`` (32-bytes) to ``long`` (64-bytes).
  74. Text
  75. ~~~~
  76. ======================================================================================================================== =================== ==================== ==================== ============
  77. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  78. ======================================================================================================================== =================== ==================== ==================== ============
  79. **CanvasItem**
  80. Method ``draw_char`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  81. Method ``draw_char_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  82. Method ``draw_multiline_string`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  83. Method ``draw_multiline_string_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  84. Method ``draw_string`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  85. Method ``draw_string_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  86. **Font**
  87. Method ``draw_char`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  88. Method ``draw_char_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  89. Method ``draw_multiline_string`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  90. Method ``draw_multiline_string_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  91. Method ``draw_string`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  92. Method ``draw_string_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  93. **RichTextLabel**
  94. Method ``add_image`` adds a new ``alt_text`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-76829`_
  95. Method ``add_image`` replaced ``size_in_percent`` parameter by ``width_in_percent`` and ``height_in_percent`` |✔️| |✔️ with compat| |✔️ with compat| `GH-107347`_
  96. Method ``push_strikethrough`` adds optional ``color`` parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-106300`_
  97. Method ``push_table`` adds a new ``name`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-76829`_
  98. Method ``push_underline`` adds optional ``color`` parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-106300`_
  99. Method ``update_image`` replaced ``size_in_percent`` parameter by ``width_in_percent`` and ``height_in_percent`` |✔️| |✔️ with compat| |✔️ with compat| `GH-107347`_
  100. **TextLine**
  101. Method ``draw`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  102. Method ``draw_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  103. **TextParagraph**
  104. Method ``draw`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  105. Method ``draw_dropcap`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  106. Method ``draw_dropcap_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  107. Method ``draw_line`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  108. Method ``draw_line_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  109. Method ``draw_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  110. **TextServer**
  111. Method ``font_draw_glyph`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  112. Method ``font_draw_glyph_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  113. Method ``shaped_text_draw`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  114. Method ``shaped_text_draw_outline`` adds a new ``oversampling`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-104872`_
  115. **TreeItem**
  116. Method ``add_button`` adds a new ``alt_text`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-76829`_
  117. **TextServerExtension**
  118. Method ``_font_draw_glyph`` adds a new ``oversampling`` optional parameter |❌| |❌| |❌| `GH-104872`_
  119. Method ``_font_draw_glyph_outline`` adds a new ``oversampling`` optional parameter |❌| |❌| |❌| `GH-104872`_
  120. Method ``_shaped_text_draw`` adds a new ``oversampling`` optional parameter |❌| |❌| |❌| `GH-104872`_
  121. Method ``_shaped_text_draw_outline`` adds a new ``oversampling`` optional parameter |❌| |❌| |❌| `GH-104872`_
  122. ======================================================================================================================== =================== ==================== ==================== ============
  123. XR
  124. ~~
  125. ============================================================================================================================================================ =================== ==================== ==================== ============
  126. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  127. ============================================================================================================================================================ =================== ==================== ==================== ============
  128. **OpenXRAPIExtension**
  129. Method ``register_composition_layer_provider`` changes ``extension`` parameter type from ``OpenXRExtensionWrapperExtension`` to ``OpenXRExtensionWrapper`` |✔️| |✔️ with compat| |✔️ with compat| `GH-104087`_
  130. Method ``register_projection_views_extension`` changes ``extension`` parameter type from ``OpenXRExtensionWrapperExtension`` to ``OpenXRExtensionWrapper`` |✔️| |✔️ with compat| |✔️ with compat| `GH-104087`_
  131. Method ``unregister_composition_layer_provider`` changes ``extension`` parameter type from ``OpenXRExtensionWrapperExtension`` to ``OpenXRExtensionWrapper`` |✔️| |✔️ with compat| |✔️ with compat| `GH-104087`_
  132. Method ``unregister_projection_views_extension`` changes ``extension`` parameter type from ``OpenXRExtensionWrapperExtension`` to ``OpenXRExtensionWrapper`` |✔️| |✔️ with compat| |✔️ with compat| `GH-104087`_
  133. **OpenXRBindingModifierEditor**
  134. Type ``OpenXRBindingModifierEditor`` changed API type from Core to Editor |❌| |❌| |❌| `GH-103869`_
  135. **OpenXRInteractionProfileEditor**
  136. Type ``OpenXRInteractionProfileEditor`` changed API type from Core to Editor |❌| |❌| |❌| `GH-103869`_
  137. **OpenXRInteractionProfileEditorBase**
  138. Type ``OpenXRInteractionProfileEditorBase`` changed API type from Core to Editor |❌| |❌| |❌| `GH-103869`_
  139. ============================================================================================================================================================ =================== ==================== ==================== ============
  140. .. note::
  141. Classes ``OpenXRBindingModifierEditor``, ``OpenXRInteractionProfileEditor``, and ``OpenXRInteractionProfileEditorBase``
  142. are only available in the editor. Using them outside of the editor will result in a compilation error.
  143. In C#, this means the types are moved from the ``GodotSharp`` assembly to the ``GodotSharpEditor`` assembly.
  144. Make sure to wrap code that uses these types in a ``#if TOOLS`` block to ensure they are not included in an exported game.
  145. **This change was also backported to 4.4.1.**
  146. Editor plugins
  147. ~~~~~~~~~~~~~~
  148. ======================================================================================================================== =================== ==================== ==================== ============
  149. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  150. ======================================================================================================================== =================== ==================== ==================== ============
  151. **EditorExportPlatform**
  152. Method ``get_forced_export_files`` adds a new ``preset`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-71542`_
  153. **EditorUndoRedoManager**
  154. Method ``create_action`` adds a new ``mark_unsaved`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-106121`_
  155. **EditorExportPlatformExtension**
  156. Method ``_get_option_icon`` changes return type from ``ImageTexture`` to ``Texture2D`` |✔️| |❌| |❌| `GH-108825`_
  157. ======================================================================================================================== =================== ==================== ==================== ============
  158. Behavior changes
  159. ----------------
  160. In 4.5 some behavior changes have been introduced, which might require you to adjust your project.
  161. 3D Model Import
  162. ~~~~~~~~~~~~~~~
  163. A fix has been made to the 3D model importers to correctly handle non-joint nodes within a skeleton hierarchy (`GH-104184`_).
  164. To preserve compatibility, the default behavior is to import existing files with the same behavior as before (`GH-107352`_).
  165. New ``.gltf``, ``.glb``, ``.blend``, and ``.fbx`` files (without a corresponding ``.import`` file)
  166. will be imported with the new behavior. However, for existing files, if you want to use the
  167. new behavior, you must change the "Naming Version" option at the bottom of the Import dock:
  168. .. image:: img/gltf_naming_version.webp
  169. Core
  170. ~~~~
  171. .. note::
  172. :ref:`ProjectSettings.add_property_info() <class_ProjectSettings_method_add_property_info>`
  173. now prints a warning when the dictionary parameter has missing keys or invalid keys.
  174. Most importantly, it will now warn when a ``usage`` key is passed, as this key is not used.
  175. This was also the case before 4.5, but it was silently ignored instead.
  176. As a reminder, to set property usage information correctly, you must use
  177. :ref:`ProjectSettings.set_as_basic() <class_ProjectSettings_method_set_as_basic>`,
  178. :ref:`ProjectSettings.set_restart_if_changed() <class_ProjectSettings_method_set_restart_if_changed>`,
  179. or :ref:`ProjectSettings.set_as_internal() <class_ProjectSettings_method_set_as_internal>` instead.
  180. .. note::
  181. In C#, ``StringExtensions.PathJoin`` now avoids adding an extra path separator when the original string is empty,
  182. or when the appended path starts with a path separator (`GH-105281`_).
  183. .. note::
  184. In C#, ``StringExtensions.GetExtension`` now returns an empty string instead of the original string
  185. when the original string does not contain an extension (`GH-108041`_).
  186. .. note::
  187. In C#, the ``Quaternion(Vector3, Vector3)`` constructor now correctly creates a quaternion representing
  188. the shortest arc between the two input vectors. Previously, it would return incorrect values for certain inputs
  189. (`GH-107618`_).
  190. Physics
  191. ~~~~~~~
  192. .. note::
  193. When the 3D physics engine is set to Jolt Physics, you will now always have overlaps between ``Area3D`` and static
  194. bodies reported by default, as the ``physics/jolt_physics_3d/simulation/areas_detect_static_bodies`` project setting
  195. has been removed (`GH-105746`_). If you still want such overlaps to be ignored, you will need to change the collision mask
  196. or layer of either the ``Area3D`` or the static body instead.
  197. Text
  198. ~~~~
  199. .. note::
  200. In GDScript, calls to functions ``RichTextLabel::add_image`` and ``RichTextLabel::update_image`` will continue to work,
  201. but the ``size_in_percent`` argument will now be used as the value for ``width_in_percent`` and ``height_in_percent``
  202. will default to ``false`` (`GH-107347`_). To restore the previous behavior, you can explicitly set ``height_in_percent``
  203. to the same value you were passing as ``size_in_percent``.
  204. .. |❌| replace:: :abbr:`❌ (This API breaks compatibility.)`
  205. .. |✔️| replace:: :abbr:`✔️ (This API does not break compatibility.)`
  206. .. |✔️ with compat| replace:: :abbr:`✔️ (This API does not break compatibility. A compatibility method was added.)`
  207. .. _GH-71542: https://github.com/godotengine/godot/pull/71542
  208. .. _GH-76560: https://github.com/godotengine/godot/pull/76560
  209. .. _GH-76829: https://github.com/godotengine/godot/pull/76829
  210. .. _GH-98194: https://github.com/godotengine/godot/pull/98194
  211. .. _GH-103869: https://github.com/godotengine/godot/pull/103869
  212. .. _GH-103941: https://github.com/godotengine/godot/pull/103941
  213. .. _GH-104087: https://github.com/godotengine/godot/pull/104087
  214. .. _GH-104184: https://github.com/godotengine/godot/pull/104184
  215. .. _GH-104269: https://github.com/godotengine/godot/pull/104269
  216. .. _GH-104872: https://github.com/godotengine/godot/pull/104872
  217. .. _GH-104890: https://github.com/godotengine/godot/pull/104890
  218. .. _GH-105281: https://github.com/godotengine/godot/pull/105281
  219. .. _GH-105570: https://github.com/godotengine/godot/pull/105570
  220. .. _GH-105746: https://github.com/godotengine/godot/pull/105746
  221. .. _GH-106121: https://github.com/godotengine/godot/pull/106121
  222. .. _GH-106220: https://github.com/godotengine/godot/pull/106220
  223. .. _GH-106300: https://github.com/godotengine/godot/pull/106300
  224. .. _GH-106848: https://github.com/godotengine/godot/pull/106848
  225. .. _GH-107347: https://github.com/godotengine/godot/pull/107347
  226. .. _GH-107352: https://github.com/godotengine/godot/pull/107352
  227. .. _GH-107618: https://github.com/godotengine/godot/pull/107618
  228. .. _GH-108041: https://github.com/godotengine/godot/pull/108041
  229. .. _GH-108825: https://github.com/godotengine/godot/pull/108825
  230. .. _new Google Play requirements: https://android-developers.googleblog.com/2025/05/prepare-play-apps-for-devices-with-16kb-page-size.html
  231. .. _Upgrading to a new .NET version: https://learn.microsoft.com/en-us/dotnet/core/install/upgrade