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...
GD0101:被匯出的成員為 static
規則 ID |
GD0101 |
分類 |
用法 |
修正是否會破壞相容性 |
破壞性變更 - 若移除 非破壞性變更 - 若移除 |
預設啟用 |
是 |
原因
靜態成員被標註為 [Export]。靜態成員無法被匯出。
規則說明
Godot 不允許匯出靜態成員。
// Static members can't be exported.
[Export]
public static int InvalidProperty { get; set; }
// Instance members can be exported.
[Export]
public int ValidProperty { get; set; }
修正方式
要修正此規則的違規情形,請移除 [Export] 屬性或 static 關鍵字。
什麼時候應該忽略警告
請勿忽略此規則的警告。靜態成員無法被匯出,Godot 將會忽略這些成員,導致執行階段錯誤。