Skip to content

Add information to migrating to Godot 4#11895

Open
skyace65 wants to merge 1 commit intogodotengine:masterfrom
skyace65:4Migration
Open

Add information to migrating to Godot 4#11895
skyace65 wants to merge 1 commit intogodotengine:masterfrom
skyace65:4Migration

Conversation

@skyace65
Copy link
Copy Markdown
Contributor

These are various changes and issues I discovered while trying to convert the LibreTrainSim project. Unfortunately I had to give up the project due to a lack of time but I wanted to make sure these changes got documented here, would have saved me a lot of time when I first did that project.

@skyace65 skyace65 requested a review from a team as a code owner March 31, 2026 21:54
@skyace65 skyace65 added enhancement area:manual Issues and PRs related to the Manual/Tutorials section of the documentation labels Mar 31, 2026
@skyace65 skyace65 force-pushed the 4Migration branch 2 times, most recently from 6b1aab0 to 0872c4f Compare March 31, 2026 22:05
Comment on lines +675 to +676
- In :ref:`class_@GlobalScope` ``string()`` was renamed to ``str()``
- :ref:`class_@GlobalScope`'s enum ``Margin`` has been completely removed
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String() (uppercase S) and str() both exist in Godot 4. However, there has never been a string() (lowercase S) in Godot. See this 3.6 screenshot:

Image
Suggested change
- In :ref:`class_@GlobalScope` ``string()`` was renamed to ``str()``
- :ref:`class_@GlobalScope`'s enum ``Margin`` has been completely removed
- :ref:`class_@GlobalScope`'s enum ``Margin`` has been completely removed.

- :ref:`class_@GlobalScope`'s enum ``Margin`` has been completely removed
- ``get_joy_axis_string()`` was removed from ``Input``. There is no replacement, any code that
relied on this should be changed to work with ints: `GH-43591 <https://github.com/godotengine/godot/pull/43591>`
- ``Plus_File()`` was removed. Any code that used it should be changed to manually add a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String.plus_file() was replaced with String.path_join(). This should probably be added to the project converter's renames_map_3_to_4.cpp, as it doesn't appear to be there.

``make_current()``
- ``lerp()`` will **NOT** automatically convert an int to a float anymore. If a float is
your second value, add a ``.0`` to the int
- MSAA viewport and project settings have been split up between 2D and 3D
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project converter should convert existing MSAA settings/values to msaa_3d, as 2D MSAA did not exist in Godot 3.

Comment on lines +712 to +713
- ``lerp()`` will **NOT** automatically convert an int to a float anymore. If a float is
your second value, add a ``.0`` to the int
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would mention the use of lerpf() instead, as it's typed and always returns a float.

- Using ``@export`` followed by the type hint in parenthesis, for example
``@export (int) var MyVar``, is no longer valid syntax. Please see the :ref:<gdscript exports
page for correct syntax.
- ``set_target_fps()`` is now ``set_max_fps()``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add this to the project converter renames map. (iterations_per_second -> physics_ticks_per_second is already there.)

Comment thread tutorials/migrating/upgrading_to_godot_4.rst Outdated
Comment thread tutorials/migrating/upgrading_to_godot_4.rst Outdated
Comment thread tutorials/migrating/upgrading_to_godot_4.rst Outdated
Comment thread tutorials/migrating/upgrading_to_godot_4.rst Outdated
Comment thread tutorials/migrating/upgrading_to_godot_4.rst Outdated
@skyace65
Copy link
Copy Markdown
Contributor Author

skyace65 commented Apr 6, 2026

Committed some of the suggested changes. Looking into other mentioned stuff, need to re-check what made me add these to my converter notes originally.


- Materials set in ``MeshInstance`` properties in 3.x will need to be re-assigned in
4.0.
- ``Surface Material Override``s need to be manually set again.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``Surface Material Override``s need to be manually set again.
- ``Surface Material Override``\ s need to be manually set again.

I think to ensure proper formatting

- ``Surface Material Override``s need to be manually set again.
- ``Label3D``s will need their fonts re-assigned to them. In addition their font
size will need to be manually adjusted.
- The location of your default audio bus may need to be set again in project settings.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The location of your default audio bus may need to be set again in project settings.
- The location of your default audio bus may need to be set again in the project settings.

- In ``_get_property_list()``, the ``noslider`` property hint string is now ``no_slider``.
- VisualShaderNodeVec4Parameter now takes a :ref:`class_Vector4` as parameter
instead of a :ref:`class_Quaternion`.
- In :ref:`class_@GlobalScope` ``string()`` was renamed to ``str()``
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- In :ref:`class_@GlobalScope` ``string()`` was renamed to ``str()``
- In :ref:`class_@GlobalScope` ``string()`` was renamed to ``str()``.

For all

- :ref:`class_@GlobalScope`'s enum ``Margin`` has been completely removed
- ``get_joy_axis_string()`` was removed from ``Input``. There is no replacement, any code that
relied on this should be changed to work with ints: `GH-43591 <https://github.com/godotengine/godot/pull/43591>`
- ``Plus_File()`` was removed. Any code that used it should be changed to manually add a
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``Plus_File()`` was removed. Any code that used it should be changed to manually add a
- ``plus_file()`` was removed. Any code that used it should be changed to manually add a

No?

- ``_unhandled_key_input`` now takes ``InputEvent`` instead of ``InputEventKey``
- ``get_font()`` is now ``get_theme_font()``
- ``ResourceInteractiveLoader`` has been fully removed
- in :ref:`class_OS` the arguments for ``execute()`` have changed. ``blocking`` has been removed,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- in :ref:`class_OS` the arguments for ``execute()`` have changed. ``blocking`` has been removed,
- In :ref:`class_OS` the arguments for ``execute()`` have changed. ``blocking`` has been removed,

- ``get_font()`` is now ``get_theme_font()``
- ``ResourceInteractiveLoader`` has been fully removed
- in :ref:`class_OS` the arguments for ``execute()`` have changed. ``blocking`` has been removed,
in Godot 4 blocking the main thread until completion is the default behavior now. Use of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
in Godot 4 blocking the main thread until completion is the default behavior now. Use of
in Godot 4 blocking the main thread until completion is now the default behavior. Use of

``intersect_ray()`` arguments must now be provided in the form of
``PhysicsRayQueryParameters3D`` or ``PhysicsRayQueryParameters2D``. Within the query
parameters the order of the collision mask and array arguments have been switched, and
the ``collide_with_bodies`` and ``Colide_with_areas`` arguments have been removed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the ``collide_with_bodies`` and ``Colide_with_areas`` arguments have been removed.
the ``collide_with_bodies`` and ``colide_with_areas`` arguments have been removed.

Manual resource fixes
~~~~~~~~~~~~~~~~~~~~~

Some scene resources will need to be manually setup again to look or behave the way
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Some scene resources will need to be manually setup again to look or behave the way
Some scene resources will need to be manually set up again to look or behave the way

"Setup" is a noun

- Materials set in ``MeshInstance`` properties in 3.x will need to be re-assigned in
4.0.
- ``Surface Material Override``s need to be manually set again.
- ``Label3D``s will need their fonts re-assigned to them. In addition, their font
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``Label3D``s will need their fonts re-assigned to them. In addition, their font
- ``Label3D``\ s will need their fonts re-assigned to them. In addition, their font

``PhysicsRayQueryParameters3D`` or ``PhysicsRayQueryParameters2D``. Within the query
parameters the order of the collision mask and array arguments have been switched, and
the ``collide_with_bodies`` and ``Colide_with_areas`` arguments have been removed.
- :ref:`class_Label`'s ``Align`` property is now ``HorizontalAllignment``.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- :ref:`class_Label`'s ``Align`` property is now ``HorizontalAllignment``.
- :ref:`class_Label`'s ``align`` property is now ``horizontal_alignment``.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants