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...
GD0107:未繼承自 Node 的型別不應匯出 Node 成員
規則 ID |
GD0107 |
分類 |
用法 |
修正是否會破壞相容性 |
破壞性變更 |
預設啟用 |
是 |
原因
未繼承自 Node 的型別包含被匯出的、繼承自 Node 的欄位或屬性。
規則說明
被匯出的 Node 會被序列化為 NodePath。只有繼承自 Node 的型別才能從 NodePath 取得節點實例。
修正方式
要修正此規則的違規情形,請避免在未繼承自 Node 的型別上匯出 Node 成員,或考慮改為匯出 NodePath。
什麼時候應該忽略警告
請勿忽略此規則的警告。未繼承自 Node 的型別將無法取得被匯出的 Node 成員對應的節點實例,會導致執行階段錯誤。