playcanvas / playcanvas/engine

Element component enable/disable before first initialize leads to element being drawn all over the screen.

Open
#3,308 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: ui
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

Project: https://playcanvas.com/project/810589/overview/uibug

Description

It is a weird bug, that I have encountered various times working with UI systems, which was difficult to narrow down.
Launch a project, and see a white screen, while the entity with the element component is disabled at that moment. It should not be rendered at all.

Steps to Reproduce
  1. Have a 2D Screen
  2. Add entity with an image element
  3. Disable that entity
  4. Enable that entity post-launch, but disable straight away in initialize script attached to that entity.
Issue:

That whole image is now drawn over the whole screen, even when it is being disabled.
This has bitten me and other devs many times and is hard to figure out why it is happening in complex scenarios.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the behavior in the linked PlayCanvas project using the listed screen, image element, and initialize steps, then trace the element component's enable/disable and rendering lifecycle. Done means a component disabled in initialize is not drawn, including when it was enabled after launch.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.