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...
GD0105:导出的属性是一个索引器
规则 ID |
GD0105 |
类别 |
用法 |
修复是破坏性的还是非破坏性的 |
非破坏性的 |
默认启用 |
是 |
原因
索引器使用 [Export] 属性注解。索引器无法被导出。
规则说明
Godot 不允许导出索引器属性。
private int[] _backingField;
// Indexers can't be exported.
[Export]
public int this[int index]
{
get => _backingField[index];
set => _backingField[index] = value;
}
如何解决违规情况
要修复违反该规则的情况,请移除 [Export] 属性。
何时抑制警告
不要抑制该规则的警告。索引器无法被导出,因此它们将被 Godot 忽略,从而导致运行时错误。