Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Upgrading from Godot 4.5 to Godot 4.6
For most games and apps made with 4.5 it should be relatively safe to migrate to 4.6. This page intends to cover everything you need to pay attention to when migrating your project.
做出更改
If you are migrating from 4.5 to 4.6, the breaking changes listed here might affect you. Changes are grouped by areas/systems.
這篇文章指出了每項破壞性改動是否會影響 GDScript,以及 C# 的破壞性改動是 二進位相容 還是 原始程式碼相容:
二進位相容 - 現有二進位檔可在無需重新編譯的情況下成功載入與執行,且執行時行為不會改變。
** 原始程式碼相容** —— 在升級 Godot 時,原始程式碼可成功編譯,無需更改。
核心
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
FileAccess |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
效能 |
||||
Method |
✔️ |
✔️ |
✔️ |
動畫
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
動畫播放器(AnimationPlayer) |
||||
Property |
✔️ |
❌ |
❌ |
|
Property |
✔️ |
❌ |
❌ |
|
Property |
✔️ |
❌ |
❌ |
|
Method |
✔️ |
❌ |
❌ |
|
Signal |
✔️ |
❌ |
❌ |
3D
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
SpringBoneSimulator3D |
||||
Method |
✔️ |
❌ |
✔️ |
|
Method |
✔️ |
❌ |
✔️ |
|
Method |
✔️ |
❌ |
✔️ |
|
Method |
✔️ |
❌ |
✔️ |
|
Method |
✔️ |
❌ |
✔️ |
|
Method |
✔️ |
❌ |
✔️ |
算繪
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
DisplayServer |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
建立節點
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
Control |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
FileDialog |
||||
Method |
✔️ |
✔️ |
✔️ |
|
LineEdit |
||||
Method |
✔️ |
✔️ |
✔️ |
|
SplitContainer |
||||
Method |
✔️ |
✔️ |
✔️ |
網路
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
StreamPeerTCP |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
❌ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
TCPServer |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
OpenXR
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
OpenXRExtensionWrapper |
||||
Method |
❌ |
❌ |
❌ |
|
Method |
N/A |
N/A |
N/A |
備註
The OpenXRExtensionWrapper type is intended to be subclassed from GDExtensions. The method _set_instance_create_info_and_get_next_pointer
has a void* parameter so it's not exposed to scripting.
編輯器
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
|---|---|---|---|---|
EditorExportPreset |
||||
Method |
✔️ |
❌ |
❌ |
|
EditorFileDialog |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
❌ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
❌ |
✔️ |
|
Property |
✔️ |
❌ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
❌ |
✔️ |
|
Signal |
✔️ |
❌ |
✔️ |
|
Signal |
✔️ |
❌ |
✔️ |
|
Signal |
✔️ |
❌ |
✔️ |
做出更改
Android
備註
The source sets configuration for Android export templates has been updated to match the default Android Studio project structure (GH-110829). This affects the directory layout of the Android project:
Files previously in
[Project root]/android/build/src/are now in[Project root]/android/build/src/main/java/.Android manifest file and assets directory have been moved to
src/main/subdirectories.
For example, GodotApp.java moved from src/com/godot/game/GodotApp.java to
src/main/java/com/godot/game/GodotApp.java.
核心
備註
The TSCN 檔案格式 has changed in two ways in Godot 4.6:
load_stepsis no longer written in scene files (GH-103352). This attribute wasn't used by the editor.Unique node IDs are now saved to scene files to help track nodes when they are moved or renamed (GH-106837). This makes scene refactoring significantly more robust.
The changes are backwards-compatible and forwards-compatible, which means scenes saved in Godot 4.5 can still be loaded in Godot 4.6 and vice-versa (notwithstanding other incompatible changes performed in the scene itself).
As a result, when saving a scene that was last edited in Godot 4.5 in Godot 4.6, significant diffs will occur in version control programs. These diffs are expected.
As a reminder, you can upgrade all files in a project to the latest format using in the editor, then committing the changes to version control. This allows you to avoid large diffs later on when editing scenes.
算繪
備註
The default blend mode for Glow is now Screen, which looks more correct but is significantly brighter than the previous Soft Light mode (GH-110671).
Several other glow defaults were changed to ensure the glow didn't become too strong, but you will likely need to tweak glow properties in Environment after upgrading.
In addition, glow's Soft Light blend mode now always behaves as it did
previously with use_hdr_2d, regardless of the Viewport's use_hdr_2d
setting (GH-109971).
When using the Mobile renderer, the rewritten glow effect will look significantly different to the previous one for performance reasons (GH-110077). You may need to further adjust glow settings in Environment to achieve a similar look to before.
備註
Volumetric fog blending has been changed to be more physically accurate (GH-112494). This will cause volumetric fog to appear brighter in most scenes.
To compensate for this, you will need to decrease volumetric fog density or brightness in Environment, or decrease the Volumetric Fog Energy property on specific lights.
Changed defaults
The following default values have been changed. If your project relies on the previous defaults, you may need to explicitly set them to the old values.
備註
The default rendering driver on Windows for newly created projects is now D3D12 (GH-113213).
This can be changed in Project Settings under rendering/rendering_device/driver.windows.
備註
The default 3D physics engine for newly created projects is now Jolt Physics (GH-105737).
This can be changed in Project Settings under physics/3d/physics_engine.
3D
Member |
Old Value |
New Value |
簡介 |
|---|---|---|---|
使用泛型方法 |
|||
Property |
NodePath("..") |
NodePath("") |
備註
The default value of skeleton has changed. Enable animation/compatibility/default_parent_skeleton_in_mesh_instance_3d in Project Settings
if the old behavior is needed for compatibility.
算繪
Member |
Old Value |
New Value |
簡介 |
|---|---|---|---|
ProjectSettings |
|||
Property |
8 |
7 |
|
Property |
613 |
618 |
|
Environment |
|||
Property |
2 |
1 |
|
Property |
0.8 |
0.3 |
|
Property |
0.0 |
0.8 |
|
Property |
1.0 |
0.4 |
|
Property |
0.0 |
0.1 |
|
Property |
1.0 |
0.0 |
|
Property |
0.2 |
0.5 |
建立節點
Property/Parameter |
Old Value |
New Value |
簡介 |
|---|---|---|---|
彈出選單(PopupMenu) |
|||
Property |
0.3 |
0.2 |
|
ResourceImporterCSVTranslation |
|||
Property |
true |
1 |