playcanvas / playcanvas/engine
Disabling a child in a script while its parent is being disabled is broken
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
This is the current enabled property setter on an Entity:
if (this._enabled !== enabled) {
this._enabled = enabled;
if (! this._parent || this._parent.enabled)
this._notifyHierarchyStateChanged(this, enabled);
}
When _notifyHierarchyStateChanged is called it will fire the disable event handler on scripts. If a script tries to disable a child Entity during this event, then the children of that Entity will not be disabled because this._parent._enabled is false. But the parent has not finished disabling itself yet.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Entity enabled property setter and _notifyHierarchyStateChanged, then reproduce a parent-disable event whose script disables a child. Trace the hierarchy state propagation and verify that the child and its descendants are disabled before considering the issue resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100