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...
GD0107:不是从 Node 派生的类型不应导出 Node 成员
规则 ID |
GD0107 |
类别 |
用法 |
修复是破坏性的还是非破坏性的 |
破坏性的 |
默认启用 |
是 |
原因
一个并未继承自 Node 的类型内包含了一个导出字段或属性,其类型继承自 Node。
规则说明
导出的节点将会被序列化为 NodePath。只有继承自 Node 的类型才能通过 NodePath 获取类型实例。
如何解决违规情况
欲解决该规则带来的冲突,请避免在并未继承自 Node 的类型中导出 Node 成员,或考虑导出 NodePath。
何时抑制警告
请勿禁止该规则的警告。未继承自 Node 的类型无法获取导出 Node 成员的正确实例,这会导致预料之外的运行时错误。