Upgrading from Godot 4.0 to Godot 4.1
For most games and apps made with 4.0, it should be relatively safe to migrate to 4.1. This page intends to cover everything you need to pay attention to when migrating your project.
破壊的変更
4.0から4.1へ移行する場合、ここに記載されている破壊的変更が影響する可能性があります。 変更点はエリア/システムごとにグループ化されています。
警告
GDExtension APIは4.1では互換性が完全に失われるため、以下の表には含まれていません。 詳細は Updating your GDExtension for 4.1 セクションを参照してください。
この記事では、各破壊的変更がGDScriptに影響するかどうか、またC#の破壊的変更が バイナリ互換 なのか ソース互換 なのかを示します:
Binary compatible - Existing binaries will load and execute successfully without recompilation, and the runtime behavior won't change.
ソース互換: Godotをアップグレードしてもソースコードの変更なしでコンパイルに成功します。
Core
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
Basis |
||||
メソッド |
✔️ |
✔️ |
✔️ |
|
Object |
||||
Method |
✔️ |
❌ |
❌ |
|
Transform3D |
||||
メソッド |
✔️ |
✔️ |
✔️ |
|
UndoRedo |
||||
Method |
✔️ |
✔️ |
✔️ |
|
WorkerThreadPool |
||||
Method |
✔️ |
❌ |
✔️ |
アニメーション
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
AnimationNode |
||||
Method |
❌ |
❌ |
❌ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
AnimationNodeStateMachinePlayback |
||||
Method |
✔️ |
❌ |
❌ |
2D nodes
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
PathFollow2D |
||||
Property |
❌ |
❌ |
❌ |
3D nodes
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
Geometry3D |
||||
Method |
✔️ |
✔️ |
❌ |
|
MeshInstance3D |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Node3D |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
GUI nodes
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
CodeEdit |
||||
Method |
✔️ |
✔️ |
✔️ |
|
RichTextLabel |
||||
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Method |
✔️ |
✔️ |
✔️ |
|
Tree |
||||
Method |
✔️ |
✔️ |
✔️ |
物理
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
Area2D |
||||
Property |
❌ |
❌ |
❌ |
|
Area3D |
||||
Property |
❌ |
❌ |
❌ |
|
PhysicsDirectSpaceState2D |
||||
Method |
❌ |
❌ |
❌ |
|
PhysicsDirectSpaceState3D |
||||
Method |
❌ |
❌ |
❌ |
レンダリング
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
RDShaderFile |
||||
Method |
✔️ |
❌ |
❌ |
|
RenderingDevice |
||||
Method |
✔️ |
✔️ |
❌ |
|
RenderingServer |
||||
Method |
✔️ |
❌ |
❌ |
|
SurfaceTool |
||||
Method |
✔️ |
✔️ |
❌ |
ネットワーク
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
WebRTCPeerConnectionExtension |
||||
Method |
✔️ |
❌ |
✔️ |
エディタプラグイン
Change |
GDScript Compatible |
C# バイナリ互換 |
C# ソース互換 |
Introduced |
|---|---|---|---|---|
AnimationTrackEditPlugin |
||||
Type |
❌ |
❌ |
❌ |
|
EditorInterface |
||||
Type |
✔️ |
❌ |
❌ |
|
Method |
✔️ |
❌ |
❌ |
|
Method |
✔️ |
❌ |
❌ |
|
EditorResourcePreviewGenerator |
||||
Method |
❌ |
❌ |
❌ |
|
Method |
❌ |
❌ |
❌ |
|
EditorUndoRedoManager |
||||
Method |
✔️ |
✔️ |
✔️ |
Behavior changes
In 4.1, some behavior changes have been introduced, which might require you to adjust your project.
Change |
Introduced |
|---|---|
SubViewportContainer |
|
When input events should reach SubViewports and their children, |
|
Multiple layered |
|
Viewport |
|
|
Updating your GDExtension for 4.1
In order to fix a serious bug, in Godot 4.1 we had to break binary compatibility in a big way and source compatibility in a small way.
This means that GDExtensions made for Godot 4.0 will need to be recompiled for Godot 4.1
(using the 4.1 branch of godot-cpp), with a small change to their source code.
In Godot 4.0, your "entry_symbol" function looks something like this:
GDExtensionBool GDE_EXPORT example_library_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
init_obj.register_initializer(initialize_example_module);
init_obj.register_terminator(uninitialize_example_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}
However, for Godot 4.1, it should look like:
GDExtensionBool GDE_EXPORT example_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
init_obj.register_initializer(initialize_example_module);
init_obj.register_terminator(uninitialize_example_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}
There are two small changes:
The first argument changes from
const GDExtensionInterface *p_interfacetoGDExtensionInterfaceGetProcAddress p_get_proc_addressThe constructor for the init_obj variable now receives
p_get_proc_addressas its first parameter
You also need to add an extra compatibility_minimum line to your .gdextension file, so that it looks something like:
[configuration]
entry_symbol = "example_library_init"
compatibility_minimum = 4.1
This lets Godot know that your GDExtension has been updated and is safe to load in Godot 4.1.