Phaser API Documentation

  Version: 
addToDisplayList([displayList])

Description:

Adds this Layer to the given Display List.

If no Display List is specified, it will default to the Display List owned by the Scene to which this Layer belongs.

A Layer can only exist on one Display List at any given time, but may move freely between them.

If this Layer is already on another Display List when this method is called, it will first be removed from it, before being added to the new list.

You can query which list it is on by looking at the Phaser.GameObjects.Layer#displayList property.

If a Layer isn't on any display list, it will not be rendered. If you just wish to temporarily disable it from rendering, consider using the setVisible method, instead.

Parameters:

name type arguments description
displayList Phaser.GameObjects.DisplayList | Phaser.GameObjects.Layer <optional>

The Display List to add to. Defaults to the Scene Display List.

Returns:
Description:

This Layer.

Since: 3.60.0