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...
GD0001: Missing partial modifier on declaration of type that derives from GodotObject¶
规则 ID |
GD0001 |
类别 |
用法 |
修复是中断修复还是非中断修复 |
Non-breaking |
默认启用 |
是 |
原因¶
A type that derives from GodotObject is not declared partial.
规则说明¶
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.
// The source generators can't enhance this type to work with Godot.
public class InvalidNode : Node { }
// The source generators can enhance this type to work with Godot.
public partial class ValidNode { }
如何解决冲突¶
To fix a violation of this rule, add the partial keyword to the type
declaration.
何时禁止显示警告¶
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.