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.

GD0103: 내보낸 멤버는 읽기 전용입니다.

규칙 ID

GD0103

카테고리

사용례

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

굽기

기본적으로 활성화됨

es

원인

읽기 전용 멤버에는 [Export] 속성으로 주석이 추가됩니다. 읽기 전용 멤버는 내보낼 수 없습니다.

설명

Godot는 읽기 전용 멤버 내보내기를 허용하지 않습니다.

// Read-only fields can't be exported.
[Export]
public readonly int invalidField;

// This field can be exported because it's not declared 'readonly'.
[Export]
public int validField;

// Read-only properties can't be exported.
[Export]
public int InvalidProperty { get; }

// This property can be exported because it has both a getter and a setter.
[Export]
public int ValidProperty { get; set; }

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

필드에 대한 이 규칙 위반을 수정하려면 readonly 키워드를 제거하거나 [Export] 속성을 제거하십시오.

속성에 대한 이 규칙 위반을 해결하려면 속성이 getter와 setter를 모두 선언하는지 확인하거나 [Export] 특성을 제거하세요.

경고를 억제해야 하는 경우

이 규칙에서 경고를 표시하지 마세요. 읽기 전용 멤버는 내보낼 수 없으므로 Godot에서 무시되어 런타임 오류가 발생합니다.