upgrading_to_godot_4.2.rst 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. .. _doc_upgrading_to_godot_4.2:
  2. Upgrading from Godot 4.1 to Godot 4.2
  3. =====================================
  4. For most games and apps made with 4.1 it should be relatively safe to migrate to 4.2.
  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.1 to 4.2, the breaking changes listed here might
  10. affect you. Changes are grouped by areas/systems.
  11. .. warning::
  12. The :ref:`class_Mesh` resource format has changed in 4.2 to allow for
  13. `vertex and attribute compression <https://github.com/godotengine/godot/pull/81138>`__.
  14. This allows for improved rendering performance, especially on platforms
  15. constrained by memory bandwidth such as mobile.
  16. It is still possible to load the Godot 4.0-4.1 Mesh formats, but it is
  17. **not** possible to load the Godot 4.2 Mesh format in prior Godot versions.
  18. When opening a Godot project made with a version prior to 4.2, you may
  19. be presented with an upgrade dialog that offers two options:
  20. - **Restart & Upgrade:** Upgrades the mesh format for all meshes in the
  21. project and saves the result to disk. Once chosen, this option prevents
  22. downgrading the project to a Godot version prior to 4.2. Set up a
  23. version control system and push your changes *before* choosing this option!
  24. - **Upgrade Only:** Upgrades the mesh format in-memory without writing it
  25. to disk. This allows downgrading the project to a Godot version older than 4.2
  26. if you need to do so in the future. The downside is that loading the project
  27. will be slower every time as the mesh format needs to be upgraded every time
  28. the project is loaded. These increased loading times will also affect the
  29. exported project. The number and complexity of Mesh resources determines
  30. how much loading times are affected.
  31. If this dialog doesn't appear, use **Project > Tools > Upgrade Mesh Surfaces…**
  32. at the top of the editor.
  33. This article indicates whether each breaking change affects GDScript and whether
  34. the C# breaking change is *binary compatible* or *source compatible*:
  35. - **Binary compatible** - Existing binaries will load and execute successfully without
  36. recompilation, and the runtime behavior won't change.
  37. - **Source compatible** - Source code will compile successfully without changes when
  38. upgrading Godot.
  39. Core
  40. ^^^^
  41. ======================================================================================================================== =================== ==================== ==================== ===========
  42. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  43. ======================================================================================================================== =================== ==================== ==================== ===========
  44. **Node**
  45. Constant ``NOTIFICATION_NODE_RECACHE_REQUESTED`` removed |❌| |✔️| |❌| `GH-84419`_
  46. ======================================================================================================================== =================== ==================== ==================== ===========
  47. Animation
  48. ^^^^^^^^^
  49. ======================================================================================================================== =================== ==================== ==================== ===========
  50. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  51. ======================================================================================================================== =================== ==================== ==================== ===========
  52. **AnimationPlayer**
  53. Method ``_post_process_key_value`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  54. Method ``add_animation_library`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  55. Method ``advance`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  56. Signal ``animation_finished`` moved to base class ``AnimationMixer`` |✔️| |❌| |❌| `GH-80813`_
  57. Signal ``animation_started`` moved to base class ``AnimationMixer`` |✔️| |❌| |❌| `GH-80813`_
  58. Signal ``animation_libraries_updated`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  59. Signal ``animation_list_changed`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  60. Property ``audio_max_polyphony`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  61. Signal ``caches_cleared`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  62. Method ``clear_caches`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  63. Method ``find_animation`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  64. Method ``find_animation_library`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  65. Method ``get_animation`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  66. Method ``get_animation_library`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  67. Method ``get_animation_library_list`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  68. Method ``get_animation_list`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  69. Method ``has_animation`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  70. Method ``has_animation_library`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  71. Property ``method_call_mode`` renamed to ``callback_mode_method`` and moved to base class ``AnimationMixer`` |✔️| |✔️ with compat| |✔️ with compat| `GH-80813`_
  72. Property ``playback_active`` renamed to ``active`` and moved to base class ``AnimationMixer`` |✔️| |✔️ with compat| |✔️ with compat| `GH-80813`_
  73. Property ``playback_process_mode`` renamed to ``callback_mode_process`` and moved to base class ``AnimationMixer`` |✔️| |✔️ with compat| |✔️ with compat| `GH-80813`_
  74. Method ``remove_animation_library`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  75. Method ``rename_animation_library`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  76. Property ``reset_on_save`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  77. Property ``root_node`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  78. Method ``set_reset_on_save_enabled`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  79. Method ``seek`` adds a new ``update_only`` optional parameter |✔️| |✔️ with compat| |✔️| `GH-80813`_
  80. **AnimationTree**
  81. Method ``_post_process_key_value`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  82. Property ``active`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  83. Method ``advance`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  84. Signal ``animation_finished`` moved to base class ``AnimationMixer`` |✔️| |❌| |❌| `GH-80813`_
  85. Signal ``animation_started`` moved to base class ``AnimationMixer`` |✔️| |❌| |❌| `GH-80813`_
  86. Property ``audio_max_polyphony`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  87. Method ``get_root_motion_position`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  88. Method ``get_root_motion_position_accumulator`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  89. Method ``get_root_motion_rotation`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  90. Method ``get_root_motion_rotation_accumulator`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  91. Method ``get_root_motion_scale`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  92. Method ``get_root_motion_scale_accumulator`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  93. Property ``process_callback`` renamed to ``callback_mode_process`` and moved to base class ``AnimationMixer`` |✔️| |✔️ with compat| |✔️ with compat| `GH-80813`_
  94. Property ``root_motion_track`` moved to base class ``AnimationMixer`` |✔️| |✔️| |✔️| `GH-80813`_
  95. Property ``tree_root`` changes type from ``AnimationNode`` to ``AnimationRootNode`` |✔️| |❌| |❌| `GH-80813`_
  96. ======================================================================================================================== =================== ==================== ==================== ===========
  97. GUI nodes
  98. ^^^^^^^^^
  99. ======================================================================================================================== =================== ==================== ==================== ===========
  100. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  101. ======================================================================================================================== =================== ==================== ==================== ===========
  102. **PopupMenu**
  103. Method ``add_icon_shortcut`` adds a new ``allow_echo`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-36493`_
  104. Method ``add_shortcut`` adds a new ``allow_echo`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-36493`_
  105. Method ``clear`` adds a new ``free_submenus`` optional parameter |✔️| |✔️ with compat| |✔️ with compat| `GH-79965`_
  106. **RichTextLabel**
  107. Method ``add_image`` adds new ``key``, ``pad``, ``tooltip``, and ``size_in_percent`` optional parameters |✔️| |✔️ with compat| |✔️| `GH-80410`_
  108. ======================================================================================================================== =================== ==================== ==================== ===========
  109. Rendering
  110. ^^^^^^^^^
  111. ======================================================================================================================== =================== ==================== ==================== ===========
  112. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  113. ======================================================================================================================== =================== ==================== ==================== ===========
  114. **ImporterMesh**
  115. Method ``add_surface`` changes ``flags`` parameter type from ``uint32`` to ``uint64`` |✔️| |✔️ with compat| |✔️ with compat| `GH-81138`_
  116. Method ``get_surface_format`` changes return type from ``uint32`` to ``uint64`` |✔️| |❌| |❌| `GH-81138`_
  117. **MeshDataTool**
  118. Method ``commit_to_surface`` adds a new ``compression_flags`` optional parameter |✔️| |✔️ with compat| |✔️| `GH-81138`_
  119. Method ``get_format`` changes return type from ``uint32`` to ``uint64`` |✔️| |❌| |❌| `GH-81138`_
  120. **RenderingDevice**
  121. Enum field ``BarrierMask.BARRIER_MASK_RASTER`` changes value from ``1`` to ``9`` |✔️| |✔️| |✔️| `GH-79911`_
  122. Enum field ``BarrierMask.BARRIER_MASK_ALL_BARRIERS`` changes value from ``7`` to ``32767`` |✔️| |✔️| |✔️| `GH-79911`_
  123. Enum field ``BarrierMask.BARRIER_MASK_NO_BARRIER`` changes value from ``8`` to ``32768`` |✔️| |✔️| |✔️| `GH-79911`_
  124. Method ``shader_create_from_bytecode`` adds a new ``placeholder_rid`` optional parameter |✔️| |✔️ with compat| |✔️| `GH-79606`_
  125. Method ``shader_get_vertex_input_attribute_ask`` changes return type from ``uint32`` to ``uint64`` |✔️| |❌| |❌| `GH-81138`_
  126. **SurfaceTool**
  127. Method ``commit`` changes ``flags`` parameter type from ``uint32`` to ``uint64`` |✔️| |✔️ with compat| |✔️ with compat| `GH-81138`_
  128. ======================================================================================================================== =================== ==================== ==================== ===========
  129. Text
  130. ^^^^
  131. ==================================================================================================================================== =================== ==================== ==================== ===========
  132. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  133. ==================================================================================================================================== =================== ==================== ==================== ===========
  134. **Font**
  135. Method ``set_fallbacks`` replaced with ``fallbacks`` property |✔️| |❌| |❌| `GH-78266`_
  136. Method ``get_fallbacks`` replaced with ``fallbacks`` property |✔️| |❌| |❌| `GH-78266`_
  137. Method ``find_variation`` adds new ``spacing_top``, ``spacing_bottom``, ``spacing_space``, and ``spacing_glyph`` optional parameters |✔️| |✔️ with compat| |✔️| `GH-80954`_
  138. ==================================================================================================================================== =================== ==================== ==================== ===========
  139. GraphEdit
  140. ^^^^^^^^^
  141. ======================================================================================================================== =================== ==================== ==================== ===========
  142. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  143. ======================================================================================================================== =================== ==================== ==================== ===========
  144. **GraphEdit**
  145. Property ``arrange_nodes_button_hidden`` renamed to ``show_arrange_button`` |❌| |✔️ with compat| |✔️ with compat| `GH-81582`_
  146. Method ``get_zoom_hbox`` renamed to ``get_menu_hbox`` |❌| |✔️ with compat| |✔️ with compat| `GH-79308`_
  147. Property ``snap_distance`` renamed to ``snapping_distance`` |❌| |✔️ with compat| |✔️ with compat| `GH-79308`_
  148. Property ``use_snap`` renamed to ``snapping_enabled`` |❌| |✔️ with compat| |✔️ with compat| `GH-79308`_
  149. **GraphNode**
  150. Property ``comment`` removed |❌| |❌| |❌| `GH-79307`_
  151. Signal ``close_request`` renamed to ``delete_request`` and moved to base class ``GraphElement`` |❌| |✔️ with compat| |✔️ with compat| `GH-79311`_
  152. Property ``draggable`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  153. Property ``draggable`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  154. Signal ``dragged`` moved to base class ``GraphElement`` |✔️| |❌| |❌| `GH-79311`_
  155. Method ``get_connection_input_color`` removed |❌| |❌| |❌| `GH-79311`_
  156. Method ``get_connection_input_count`` removed |❌| |❌| |❌| `GH-79311`_
  157. Method ``get_connection_input_height`` removed |❌| |❌| |❌| `GH-79311`_
  158. Method ``get_connection_input_position`` removed |❌| |❌| |❌| `GH-79311`_
  159. Method ``get_connection_input_slot`` removed |❌| |❌| |❌| `GH-79311`_
  160. Method ``get_connection_input_type`` removed |❌| |❌| |❌| `GH-79311`_
  161. Method ``get_connection_output_color`` removed |❌| |❌| |❌| `GH-79311`_
  162. Method ``get_connection_output_count`` removed |❌| |❌| |❌| `GH-79311`_
  163. Method ``get_connection_output_height`` removed |❌| |❌| |❌| `GH-79311`_
  164. Method ``get_connection_output_position`` removed |❌| |❌| |❌| `GH-79311`_
  165. Method ``get_connection_output_slot`` removed |❌| |❌| |❌| `GH-79311`_
  166. Method ``get_connection_output_type`` removed |❌| |❌| |❌| `GH-79311`_
  167. Property ``language`` removed |❌| |❌| |❌| `GH-79311`_
  168. Signal ``node_deselected`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  169. Signal ``node_selected`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  170. Property ``overlay`` removed |❌| |❌| |❌| `GH-79311`_
  171. Property ``position_offset`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  172. Signal ``position_offset_changed`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  173. Signal ``raise_request`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  174. Property ``resizable`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  175. Signal ``resize_request`` moved to base class ``GraphElement`` |✔️| |❌| |❌| `GH-79311`_
  176. Property ``selectable`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  177. Property ``selected`` moved to base class ``GraphElement`` |✔️| |✔️| |✔️| `GH-79311`_
  178. Property ``show_close`` removed |❌| |❌| |❌| `GH-79311`_
  179. Property ``text_direction`` removed |❌| |❌| |❌| `GH-79311`_
  180. ======================================================================================================================== =================== ==================== ==================== ===========
  181. TileMap
  182. ^^^^^^^
  183. ======================================================================================================================== =================== ==================== ==================== ===========
  184. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  185. ======================================================================================================================== =================== ==================== ==================== ===========
  186. **TileMap**
  187. Property ``cell_quadrant_size`` renamed to ``rendering_quadrant_size`` |❌| |✔️ with compat| |✔️ with compat| `GH-81070`_
  188. ======================================================================================================================== =================== ==================== ==================== ===========
  189. XR
  190. ^^
  191. ======================================================================================================================== =================== ==================== ==================== ===========
  192. Change GDScript Compatible C# Binary Compatible C# Source Compatible Introduced
  193. ======================================================================================================================== =================== ==================== ==================== ===========
  194. **XRInterface**
  195. Property ``environment_blend_mode`` added |✔️| |❌| |❌| `GH-81561`_
  196. ======================================================================================================================== =================== ==================== ==================== ===========
  197. .. note::
  198. This change breaks compatibility in C# because the new property conflicts with the name of an existing enum
  199. and the C# bindings generator gives priority to properties, so the enum type was renamed from
  200. ``EnvironmentBlendMode`` to ``EnvironmentBlendModeEnum``.
  201. .. |❌| replace:: :abbr:`❌ (This API breaks compatibility.)`
  202. .. |✔️| replace:: :abbr:`✔️ (This API does not break compatibility.)`
  203. .. |✔️ with compat| replace:: :abbr:`✔️ (This API does not break compatibility. A compatibility method was added.)`
  204. .. _GH-36493: https://github.com/godotengine/godot/pull/36493
  205. .. _GH-78266: https://github.com/godotengine/godot/pull/78266
  206. .. _GH-79307: https://github.com/godotengine/godot/pull/79307
  207. .. _GH-79308: https://github.com/godotengine/godot/pull/79308
  208. .. _GH-79311: https://github.com/godotengine/godot/pull/79311
  209. .. _GH-79606: https://github.com/godotengine/godot/pull/79606
  210. .. _GH-79911: https://github.com/godotengine/godot/pull/79911
  211. .. _GH-79965: https://github.com/godotengine/godot/pull/79965
  212. .. _GH-80410: https://github.com/godotengine/godot/pull/80410
  213. .. _GH-80813: https://github.com/godotengine/godot/pull/80813
  214. .. _GH-80954: https://github.com/godotengine/godot/pull/80954
  215. .. _GH-81070: https://github.com/godotengine/godot/pull/81070
  216. .. _GH-81138: https://github.com/godotengine/godot/pull/81138
  217. .. _GH-81561: https://github.com/godotengine/godot/pull/81561
  218. .. _GH-81582: https://github.com/godotengine/godot/pull/81582
  219. .. _GH-84419: https://github.com/godotengine/godot/pull/84419