Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

GD0105: Attempted to export indexer property

Regel-ID

GD0105

Kategorie

Verwendung

Breaking- oder nicht-Breaking-Fix

Non-breaking

Standardmäßig aktiviert

Ja

Ursache

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

Beschreibung der Regel

Godot doesn't allow exporting indexer properties.

private int[] _backingField;

// Indexers can't be exported.
[Export]
public int this[int index]
{
    get => _backingField[index];
    set => _backingField[index] = value;
}

Wie man Verstöße behebt

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

Wann Warnungen unterdrückt werden sollten

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