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...
GD0102:导出成员的类型不受支持
规则 ID |
GD0102 |
类别 |
用法 |
修复是破坏性的还是非破坏性的 |
破坏性的 - 如果成员类型已更改 非破坏性的 - 如果 |
默认启用 |
是 |
原因
当期望使用 Variant 兼容类型时,为用 [Export] 属性注解的成员指定了不受支持的类型。
规则说明
每个导出成员都必须与变体兼容,以便引擎能够对其进行编组。
class SomeType { }
// SomeType is not a valid member type because it doesn't derive from GodotObject,
// so it's not compatible with Variant.
[Export]
public SomeType InvalidProperty { get; set; }
// System.Int32 is a valid type because it's compatible with Variant.
[Export]
public int ValidProperty { get; set; }
如何解决违规情况
要修复违反该规则的情况,请将成员的类型更改为与变体兼容,或移除 [Export] 属性。
何时抑制警告
不要抑制该规则的警告。具有无法编组的类型的成员将导致运行时错误。