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.

GD0401: 클래스는 Godot.GodotObject 또는 파생 클래스에서 파생되어야 합니다.

규칙 ID

GD0401

카테고리

사용례

수정 내용이 중단되거나 중단되지 않음

Breaking - 상속 체인을 변경하는 경우

비계속 - [GlobalClass] 속성을 제거하는 경우

기본적으로 활성화됨

es

원인

[GlobalClass] 속성으로 주석이 달린 유형은 ``GodotObject``에서 파생되지 않습니다.

설명

``[GlobalClass]``는 ``GodotObject``에서 파생되지 않은 유형에는 효과가 없습니다. 모든 :ref:`global class <doc_c_sharp_global_classes>`는 궁극적으로 ``GodotObject``에서 파생되어야 마샬링될 수 있습니다.

// This type is not registered as a global class because it doesn't derive from GodotObject.
[GlobalClass]
class SomeType { }

// This type is a global class because it derives from Godot.Node
// which ultimately derives from GodotObject.
[GlobalClass]
class MyNode : Node { }

// This type is a global class because it derives from Godot.Resource
// which ultimately derives from GodotObject.
[GlobalClass]
class MyResource : Resource { }

독립적으로 존재해야 하는 것

이 규칙 위반을 수정하려면 GodotObject``에서 파생되도록 유형을 변경하거나 ``[GlobalClass] 속성을 제거하세요.

경고를 억제해야 하는 경우

이 규칙에서 경고를 표시하지 마세요. ``GodotObject``에서 파생되지 않은 형식에 ``[GlobalClass]``를 추가하는 것은 저지르기 쉬운 실수이며 이 경고는 사용자가 예상치 못한 오류가 발생할 수 있음을 인식하는 데 도움이 됩니다.