Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
Upgrading from Godot 4.1 to Godot 4.2¶
For most games and apps made with 4.1 it should be relatively safe to migrate to 4.2. This page intends to cover everything you need to pay attention to when migrating your project.
做出更改¶
If you are migrating from 4.1 to 4.2, the breaking changes listed here might affect you. Changes are grouped by areas/systems.
警告
The Mesh resource format has changed in 4.2 to allow for vertex and attribute compression. This allows for improved rendering performance, especially on platforms constrained by memory bandwidth such as mobile.
It is still possible to load the Godot 4.0-4.1 Mesh formats, but it is not possible to load the Godot 4.2 Mesh format in prior Godot versions. When opening a Godot project made with a version prior to 4.2, you may be presented with an upgrade dialog that offers two options:
Restart & Upgrade: Upgrades the mesh format for all meshes in the project and saves the result to disk. Once chosen, this option prevents downgrading the project to a Godot version prior to 4.2. Set up a version control system and push your changes before choosing this option!
Upgrade Only: Upgrades the mesh format in-memory without writing it to disk. This allows downgrading the project to a Godot version older than 4.2 if you need to do so in the future. The downside is that loading the project will be slower every time as the mesh format needs to be upgraded every time the project is loaded. These increased loading times will also affect the exported project. The number and complexity of Mesh resources determines how much loading times are affected.
If this dialog doesn't appear, use Project > Tools > Upgrade Mesh Surfaces… at the top of the editor.
這篇文章指出了每項破壞性改動是否會影響 GDScript,以及 C# 的破壞性改動是 二進位相容 還是 原始程式碼相容:
二進位相容 —— 現有二進位檔案無需重新編譯即可載入並成功執行,運作時的行為不會改變。
** 原始程式碼相容** —— 在升級 Godot 時,原始程式碼可成功編譯,無需更改。
核心¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
Node |
||||
Constant |
❌ |
✔️ |
❌ |
動畫¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
AnimationPlayer |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
❌ |
❌ |
|
Signal |
✔️ |
❌ |
❌ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
AnimationTree |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
❌ |
❌ |
|
Signal |
✔️ |
❌ |
❌ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
❌ |
❌ |
建立節點¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
PopupMenu |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
RichTextLabel |
||||
Method |
✔️ |
✔️ |
✔️ |
渲染¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
ImporterMesh |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
❌ |
❌ |
|
MeshDataTool |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
❌ |
❌ |
|
渲染 |
||||
Enum field |
✔️ |
✔️ |
✔️ |
|
Enum field |
✔️ |
✔️ |
✔️ |
|
Enum field |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
❌ |
❌ |
|
建立內容 |
||||
Method |
✔️ |
✔️ |
✔️ |
Text¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
霧: |
||||
Method |
✔️ |
❌ |
❌ |
|
Method |
✔️ |
❌ |
❌ |
|
Method |
✔️ |
✔️ |
✔️ |
GraphEdit¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
GraphEdit |
||||
Property |
❌ |
✔️ |
✔️ |
|
Method |
❌ |
✔️ |
✔️ |
|
Property |
❌ |
✔️ |
✔️ |
|
Property |
❌ |
✔️ |
✔️ |
|
GraphNode |
||||
Property |
❌ |
❌ |
❌ |
|
Signal |
❌ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
Property |
❌ |
❌ |
❌ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Property |
❌ |
❌ |
❌ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Signal |
✔️ |
❌ |
❌ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
✔️ |
✔️ |
✔️ |
|
Property |
❌ |
❌ |
❌ |
|
Property |
❌ |
❌ |
❌ |
TileMap¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
TileMap |
||||
Property |
❌ |
✔️ |
✔️ |
XR¶
改動 |
GDScript 格式化字串 |
C# 二進位相容 |
C# 原始程式碼相容 |
簡介 |
---|---|---|---|---|
XRInterface |
||||
Property |
✔️ |
❌ |
❌ |
備註
This change breaks compatibility in C# because the new property conflicts with the name of an existing enum
and the C# bindings generator gives priority to properties, so the enum type was renamed from
EnvironmentBlendMode
to EnvironmentBlendModeEnum
.