Skip to content

docs: clarify result.trigger?.entity vs result.triggeredEntity in TriggerArea#101

Open
decentraland-bot wants to merge 1 commit into
mainfrom
jarvis/clarify-trigger-area-fields
Open

docs: clarify result.trigger?.entity vs result.triggeredEntity in TriggerArea#101
decentraland-bot wants to merge 1 commit into
mainfrom
jarvis/clarify-trigger-area-fields

Conversation

@decentraland-bot
Copy link
Copy Markdown

Summary

The PBTriggerAreaResult callback object exposes two fields whose names lead to a very common mistake:

  • result.trigger?.entity — the entity that walked into the trigger area (usually what developers want to check)
  • result.triggeredEntity — the entity that owns the TriggerArea component (the static trigger zone itself)

Despite its name, triggeredEntity does not refer to the entity that triggered the event. The name reads as "the entity that triggered it," but it actually means "the entity whose trigger area was activated." This confusion shows up repeatedly in developer questions and is a frequent mistake made when reading or writing scene code.

Changes

  • Added a {% hint style="warning" %} admonition immediately after the field list in the Trigger event responses section that:
    • Explicitly labels each field with plain-English role and a parenthetical (Entity A / Entity B)
    • Calls out the naming trap so developers don't silently swap the two fields
    • Points to result.trigger?.entity as the correct field for identifying the entering entity

No other content was changed. The Spanish translation (creator-esp/) is excluded and will be handled separately.

Test plan

  • Preview the docs page and confirm the warning box renders correctly between the field list and the code example
  • Verify no other sections were inadvertently changed (diff is limited to the new {% hint %} block)

🤖 Generated with Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant