Skip to main content
Version: Phaser v3.88.2

LightsPlugin

A Scene plugin that provides a Phaser.GameObjects.LightsManager for the Light2D pipeline.

Available from within a Scene via this.lights.

Add Lights using the Phaser.GameObjects.LightsManager#addLight method:


// Enable the Lights Manager because it is disabled by default

this.lights.enable();



// Create a Light at [400, 300] with a radius of 200

this.lights.addLight(400, 300, 200);

For Game Objects to be affected by the Lights when rendered, you will need to set them to use the Light2D pipeline like so:


sprite.setPipeline('Light2D');

Note that you cannot use this pipeline on Graphics Game Objects or Shape Game Objects.

Constructor

new LightsPlugin(scene)

Parameters

nametypeoptionaldescription
scenePhaser.SceneNoThe Scene that this Lights Plugin belongs to.

Scope: static

Extends

Phaser.GameObjects.LightsManager

Source: src/gameobjects/lights/LightsPlugin.js#L12
Since: 3.0.0

Inherited Members

From Phaser.GameObjects.LightsManager:


Public Members

scene

scene: Phaser.Scene

Description:

A reference to the Scene that this Lights Plugin belongs to.

Source: src/gameobjects/lights/LightsPlugin.js#L52
Since: 3.0.0


systems

systems: Phaser.Scenes.Systems

Description:

A reference to the Scene's systems.

Source: src/gameobjects/lights/LightsPlugin.js#L61
Since: 3.0.0


Inherited Methods

From Phaser.GameObjects.LightsManager:


Public Methods

boot

<instance> boot()

Description:

Boot the Lights Plugin.

Source: src/gameobjects/lights/LightsPlugin.js#L78
Since: 3.0.0


destroy

<instance> destroy()

Description:

Destroy the Lights Plugin.

Cleans up all references.

Overrides: Phaser.GameObjects.LightsManager#destroy

Source: src/gameobjects/lights/LightsPlugin.js#L92
Since: 3.0.0