Up to date

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

GD0101: Attempted to export static member

Regel-ID

GD0101

Kategorie

Verwendung

Breaking- oder nicht-Breaking-Fix

Breaking - If the static keyword is removed

Non-breaking - If the [Export] attribute is removed

Standardmäßig aktiviert

Ja

Ursache

A static member is annotated with the [Export] attribute. Static members can't be exported.

Beschreibung der Regel

Godot doesn't allow exporting static members.

// Static members can't be exported.
[Export]
public static int InvalidProperty { get; set; }

// Instance members can be exported.
[Export]
public int ValidProperty { get; set; }

Wie man Verstöße behebt

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

Wann Warnungen unterdrückt werden sollten

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