GD0105: The exported property is an indexer

Rule ID

GD0105

Category

Usage

Fix is breaking or non-breaking

Non-breaking

Enabled by default

Yes

Cause

An indexer is annotated with the [Export] attribute. Indexers can’t be exported.

Rule description

Godot doesn’t allow exporting indexer properties.

  1. private int[] _backingField;
  2. // Indexers can't be exported.
  3. [Export]
  4. public int this[int index]
  5. {
  6. get => _backingField[index];
  7. set => _backingField[index] = value;
  8. }

How to fix violations

To fix a violation of this rule, remove the [Export] attribute.

When to suppress warnings

Do not suppress a warning from this rule. Indexers can’t be exported so they will be ignored by Godot, resulting in runtime errors.


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.

Previous Next