Phaser API Documentation

  Version: 
addExisting(camera, [makeMain])

Description:

Adds an existing Camera into the Camera Manager.

The Camera should either be a Phaser.Cameras.Scene2D.Camera instance, or a class that extends from it.

The Camera will have its roundPixels property set to whatever CameraManager.roundPixels is. You can change it after addition if required.

The Camera will be assigned an ID, which is used for Game Object exclusion and then added to the manager. As long as it doesn't already exist in the manager it will be added then returned.

If this method returns null then the Camera already exists in this Camera Manager.

Parameters:

name type arguments Default description
camera Phaser.Cameras.Scene2D.Camera

The Camera to be added to the Camera Manager.

makeMain boolean <optional> false

Set this Camera as being the 'main' camera. This just makes the property main a reference to it.

Returns:
Description:

The Camera that was added to the Camera Manager, or null if it couldn't be added.

Since: 3.0.0