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...
GD0002 : Modificateur partial manquant sur une déclaration d'un type qui contient des classes imbriquées qui dérivent de GodotObject
Rule ID |
GD0002 |
Catégorie |
Utilisation |
Fix is breaking or non-breaking |
Non-breaking |
Activé par défaut |
Oui |
Cause
A type that derives from GodotObject is contained in a non-partial type declaration.
Rule description
Godot source generators add generated code to user-defined types to implement the integration with the engine. Source generators can't add generated code to types that aren't declared partial.
public class InvalidParentType
{
// MyNode is contained in a non-partial type so the source generators
// can't enhance this type to work with Godot.
public partial class MyNode : Node { }
}
public partial class ValidParentType
{
// MyNode is contained in a partial type so the source generators
// can enhance this type to work with Godot.
public partial class MyNode : Node { }
}
How to fix violations
To fix a violation of this rule, add the partial keyword to the type
declaration.
Quand supprimer les avertissements
Do not suppress a warning from this rule. Types that derive from GodotObject
but aren't partial can't be enhanced by the source generators, resulting in
unexpected runtime errors.