Phaser API Documentation

  Version: 
addToDisplayList([displayList])

Description:

Adds this Game Object 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 Game Object belongs.

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

If this Game Object 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.GameObject#displayList property.

If a Game Object isn't on any display list, it will not be rendered. If you just wish to temporarly 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 Game Object.

Since: 3.53.0