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...
Upgrade von Godot 4.0 auf Godot 4.1
Für die meisten Spiele und Anwendungen, die mit 4.0 entwickelt wurden, sollte es relativ sicher sein, auf 4.1 zu migrieren. Diese Seite soll alles abdecken, was Sie bei der Migration Ihres Projekts beachten müssen.
Änderungen, die etwas kaputtmachen können
Wenn Sie von 4.0 auf 4.1 migrieren, könnten Sie von den hier aufgeführten Brüchen betroffen sein. Die Änderungen sind nach Bereichen/Systemen gruppiert.
Warnung
Die GDExtension-API ist in 4.1 nicht mehr kompatibel, daher ist sie in der Tabelle unten nicht enthalten. Siehe den Abschnitt Aktualisieren Ihrer GDExtension für 4.1 für weitere Informationen.
Dieser Artikel gibt an, ob die einzelnen Änderungen GDScript betreffen und ob die C#-Änderung binärkompatibel oder quelltextkompatibel ist:
Binary compatible - Existing binaries will load and execute successfully without recompilation, and the runtime behavior won't change.
Quellcodekompatibel - Der Quellcode wird beim Upgrade von Godot ohne Änderungen erfolgreich kompiliert.
Kern
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
Basis |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
Object |
||||
Methode |
✔️ |
❌ |
❌ |
|
Transform3D |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
UndoRedo |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
WorkerThreadPool |
||||
Methode |
✔️ |
❌ |
✔️ |
Animation
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
AnimationNode |
||||
Methode |
❌ |
❌ |
❌ |
|
Methode |
✔️ |
✔️ |
✔️ |
|
Methode |
✔️ |
✔️ |
✔️ |
|
AnimationNodeStateMachinePlayback |
||||
Methode |
✔️ |
❌ |
❌ |
2D-Nodes
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
PathFollow2D |
||||
Property |
❌ |
❌ |
❌ |
3D-Nodes
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
Geometry3D |
||||
Methode |
✔️ |
✔️ |
❌ |
|
MeshInstance3D |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
Node3D |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
Methode |
✔️ |
✔️ |
✔️ |
GUI-Nodes
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
CodeEdit |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
RichTextLabel |
||||
Methode |
✔️ |
✔️ |
✔️ |
|
Methode |
✔️ |
✔️ |
✔️ |
|
Methode |
✔️ |
✔️ |
✔️ |
|
Tree |
||||
Methode |
✔️ |
✔️ |
✔️ |
Physik
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
Area2D |
||||
Property |
❌ |
❌ |
❌ |
|
Area3D |
||||
Property |
❌ |
❌ |
❌ |
|
PhysicsDirectSpaceState2D |
||||
Methode |
❌ |
❌ |
❌ |
|
PhysicsDirectSpaceState3D |
||||
Methode |
❌ |
❌ |
❌ |
Rendern
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
RDShaderFile |
||||
Methode |
✔️ |
❌ |
❌ |
|
RenderingDevice |
||||
Methode |
✔️ |
✔️ |
❌ |
|
RenderingServer |
||||
Methode |
✔️ |
❌ |
❌ |
|
SurfaceTool |
||||
Die Methode |
✔️ |
✔️ |
❌ |
Netzwerkfunktionen
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
WebRTCPeerConnectionExtension |
||||
Methode |
✔️ |
❌ |
✔️ |
Editor-Plugins
Veränderung |
GDScript- kompatibel |
C#-binär- kompatibel |
C#-quellcode- kompatibel |
Eingeführt in |
|---|---|---|---|---|
AnimationTrackEditPlugin |
||||
Typ |
❌ |
❌ |
❌ |
|
EditorInterface |
||||
Typ |
✔️ |
❌ |
❌ |
|
Methode |
✔️ |
❌ |
❌ |
|
Methode |
✔️ |
❌ |
❌ |
|
EditorResourcePreviewGenerator |
||||
Methode |
❌ |
❌ |
❌ |
|
Methode |
❌ |
❌ |
❌ |
|
EditorUndoRedoManager |
||||
Methode |
✔️ |
✔️ |
✔️ |
Änderungen am Verhalten
In 4.1, some behavior changes have been introduced, which might require you to adjust your project.
Veränderung |
Eingeführt in |
|---|---|
SubViewportContainer |
|
Wenn Eingabeereignisse SubViewports und deren Unterelemente erreichen sollen, muss |
|
|
|
Viewport |
|
|
Aktualisieren Ihrer GDExtension für 4.1
Um einen schwerwiegenden Fehler zu beheben, mussten wir in Godot 4.1 die Binärkompatibilität in großem und die Quellcodekompatibilität in kleinem Umfang brechen.
Dies bedeutet, dass GDExtensions, die für Godot 4.0 erstellt wurden, für Godot 4.1 neu kompiliert werden müssen (unter Verwendung des 4.1-Zweigs von godot-cpp), wobei eine kleine Änderung am Quellcode vorgenommen wird.
In Godot 4.0 sieht Ihre "entry_symbol"-Funktion etwa so aus:
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();
}
Für Godot 4.1 sollte es jedoch wie folgt aussehen:
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();
}
Es gibt zwei kleine Änderungen:
Das erste Argument ändert sich von
const GDExtensionInterface *p_interfacezuGDExtensionInterfaceGetProcAddress p_get_proc_addressDer Konstruktor für die Variable init_obj erhält nun
p_get_proc_addressals ersten 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
Damit wird Godot mitgeteilt, dass Ihre GDExtension aktualisiert wurde und sicher in Godot 4.1 geladen werden kann.