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...
Mise à niveau de Godot 4.0 vers Godot 4.1
Pour la plupart des jeux et applications fabriqués en 4.0, il devrait être relativement sûr de migrer à la 4.1. Cette page a l'intention de couvrir tout ce dont vous avez besoin pour faire attention lors de la migration de votre projet.
Changements incompatibles
Si vous migrez de la 4.0 à la 4.1, les changements cassants énumérés ici pourraient vous affecter. Les changements sont regroupés par zones/systèmes.
Avertissement
L'API GDExtension casse complètement la compatibilité en 4.1, donc elle n'est pas inclus dans le tableau ci-dessous. Voir la section Mise à jour de votre GDExtension pour la 4.1 pour plus d'informations.
This article indicates whether each breaking change affects GDScript and whether the C# breaking change is binary compatible or source compatible:
Binaire compatible - Les binaires existantes vont charger et s'exécuter avec succès sans recompilation, et le comportement lors de l'exécution ne changera pas.
Compatible source - Le code source compilera avec succès sans changement lors de la mise à niveau de Godot.
Core
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
Basis |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
Object |
||||
La méthode |
✔️ |
❌ |
❌ |
|
Transform3D |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
UndoRedo |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
WorkerThreadPool |
||||
La méthode |
✔️ |
❌ |
✔️ |
Animation
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
AnimationNode |
||||
La méthode |
❌ |
❌ |
❌ |
|
La méthode |
✔️ |
✔️ |
✔️ |
|
La méthode |
✔️ |
✔️ |
✔️ |
|
AnimationNodeStateMachinePlayback |
||||
La méthode |
✔️ |
❌ |
❌ |
Nœuds 2D
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
PathFollow2D |
||||
Propriété |
❌ |
❌ |
❌ |
Nœuds 3D
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
Geometry3D |
||||
La méthode |
✔️ |
✔️ |
❌ |
|
MeshInstance3D |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
Node3D |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
La méthode |
✔️ |
✔️ |
✔️ |
Nœuds GUI
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
CodeEdit |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
RichTextLabel |
||||
La méthode |
✔️ |
✔️ |
✔️ |
|
La méthode |
✔️ |
✔️ |
✔️ |
|
La méthode |
✔️ |
✔️ |
✔️ |
|
Tree |
||||
La méthode |
✔️ |
✔️ |
✔️ |
Physique
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
Area2D |
||||
La propriété |
❌ |
❌ |
❌ |
|
Area3D |
||||
La propriété |
❌ |
❌ |
❌ |
|
PhysicsDirectSpaceState2D |
||||
La méthode |
❌ |
❌ |
❌ |
|
PhysicsDirectSpaceState3D |
||||
La méthode |
❌ |
❌ |
❌ |
Rendu
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
RDShaderFile |
||||
La méthode |
✔️ |
❌ |
❌ |
|
RenderingDevice |
||||
La méthode |
✔️ |
✔️ |
❌ |
|
RenderingServer |
||||
La méthode |
✔️ |
❌ |
❌ |
|
SurfaceTool |
||||
La méthode |
✔️ |
✔️ |
❌ |
Réseau
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
WebRTCPeerConnectionExtension |
||||
La méthode |
✔️ |
❌ |
✔️ |
Extensions pour l'éditeur
Modifications |
Compatible GDScript |
Compatible binaire C# |
Compatible source C# |
Intégré |
|---|---|---|---|---|
AnimationTrackEditPlugin |
||||
Type |
❌ |
❌ |
❌ |
|
EditorInterface |
||||
Le type |
✔️ |
❌ |
❌ |
|
Méthode |
✔️ |
❌ |
❌ |
|
Méthode |
✔️ |
❌ |
❌ |
|
EditorResourcePreviewGenerator |
||||
La méthode |
❌ |
❌ |
❌ |
|
La méthode |
❌ |
❌ |
❌ |
|
EditorUndoRedoManager |
||||
La méthode |
✔️ |
✔️ |
✔️ |
Changements de comportement
En 4.1, certains changements de comportement ont été introduits, ce qui pourrait vous obliger à ajuster votre projet.
Modifications |
Intégré |
|---|---|
SubViewportContainer |
|
Lorsque les événements d'entrée doivent atteindre des SubViewports et leurs enfants, |
|
Plusieurs couches de nœuds |
|
Viewport |
|
Les nœuds |
Mise à jour de votre GDExtension pour la 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.
Cela signifie que les GDExtensions faites pour Godot 4.0 devront être recompilées pour Godot 4.1 (en utilisant la branche 4.1 de godot-cpp), avec un petit changement à leur code source.
Dans Godot 4.0, votre fonction "entry_symbol" ressemble à ceci :
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();
}
Cependant, pour Godot 4.1, il devrait ressembler à :
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();
}
Il y a deux petits changements :
Le premier argument change de
const GDExtension Interface *p_interfaceàGDExtensionInterfaceGetProcAddress p_get_proc_addressLe constructeur de la variable init_obj reçoit dorénavant
p_get_proc_addresscomme premier paramètre
Vous devez également ajouter une ligne compatibility_minimum supplémentaire à votre fichier .gdextension, de sorte que cela ressemble à :
[configuration]
entry_symbol = "example_library_init"
compatibility_minimum = 4.1
Ça permet à Godot de savoir que votre GDExtension a été mise à jour et est sûre de charger en Godot 4.1.