Skip to content

Having render: {} in phaser's config adds black background to Phaser. #6097

Closed
@michalfialadev

Description

@michalfialadev

Version

  • Phaser Version: 3.55.2, 3.24.1 (tested both)
  • Operating system: win10
  • Browser:
    chrome

Description

Phaser clears/fill background with solid black (affects both CANVAS and WEBGL rendering modes), when render: {} (empty or filled) render object is present in it's config.

EDIT: samme was kind to explain, that transparent can be set in Phaser's config in 2 places, and the 'latter default' (false in render{}) in this case overrode the earlier 'true' (in config root). At this point i'd suggest that a check be made in phaser source (eg 'if proprerty is set somewhere in config object, do not override it by 'unset default value' elsewhere - i think for this resolution values of 'undefined' vs false|true could be used [in case of booleans]).

Example Test Code

Following code displays black background in phaser canvas:
myPhaserConfig = { type: Phaser.AUTO, transparent: true, render: {}}

Following code displays transparent background (expected):
myPhaserConfig = { type: Phaser.AUTO, transparent: true, }

As you can see, the only difference is, that we have removed the empty 'render' object.

Additional Information

Can be quickly reproduced by going to
https://labs.phaser.io/edit.html?src=src/game%20config/transparent.js&v=3.55.2
and adding a quick render: {} into phaser's config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions