Skip to content

docs: Clarify Object custom-property name collision in class reference - #122435

Closed
basteez wants to merge 1 commit into
godotengine:masterfrom
basteez:docs-object-property-collision-64227
Closed

docs: Clarify Object custom-property name collision in class reference#122435
basteez wants to merge 1 commit into
godotengine:masterfrom
basteez:docs-object-property-collision-64227

Conversation

@basteez

@basteez basteez commented Aug 15, 2026

Copy link
Copy Markdown

What this changes

Adds a clarifying Note: to the _get_property_list() description in the Object class reference (doc/classes/Object.xml), warning that a custom property's name must not collide with an existing member variable or built-in property (including @export vars).

Why

Reported in #64227: a user defined a real member variable and returned a property with the same name from _get_property_list(), then overrode _set() to react to changes. Their _set() was never called, so the inspector never refreshed. Prefixing the name (e.g. /my_property) made it work, because the name no longer matched a real member.

This is intended behavior, confirmed by @HolonProduction in the issue thread — _get()/_set() are not called for built-in properties, and a _get_property_list() entry whose name matches a member collides with that built-in property.

The existing _get()/_set() notes already state the "not called for built-in properties" half. What was missing is the connection: don't reuse a member variable's name for a custom property. This PR adds exactly that, at the method that adds the names.

The note

The name of a property added here must not match an existing member variable or built-in property (including one defined with @export). If it does, the engine handles it as that built-in property, and your _get() and _set() overrides are not called for it.

Prose-only (no code sample), so it can't drift out of sync across the GDScript/C# examples. It frames the rule generally rather than documenting the / prefix as a supported feature, since that's an incidental side effect of the name no longer matching a member.

Scope

Docs-only. No C++, no scripting API, no other XML files. The GDScript tutorial prose quoted in the report lives in godot-docs and could get a matching clarification as a follow-up there.

Testing

  • make_rst.py doc/classes modules platform --dry-run reports no warnings or errors; all [method ...] / [annotation ...] references resolve.
  • git diff --stat shows only doc/classes/Object.xml changed.

Closes #64227

@basteez
basteez requested a review from a team as a code owner August 15, 2026 10:22
@akien-mga akien-mga closed this Aug 15, 2026
@akien-mga

Copy link
Copy Markdown
Member

AI generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ungrouped variables exported through _get_property_list() require a preceding / to avoid using a custom setter.

2 participants