Phaser API Documentation

  Version: 
replace(oldChild, newChild, [destroyChild])

Description:

Replaces a Game Object in this Container with the new Game Object. The new Game Object cannot already be a child of this Container.

Parameters:

name type arguments Default description
oldChild Phaser.GameObjects.GameObject

The Game Object in this Container that will be replaced.

newChild Phaser.GameObjects.GameObject

The Game Object to be added to this Container.

destroyChild boolean <optional> false

Optionally call destroy on the Game Object if successfully removed from this Container.

Returns:
Description:

This Container instance.

Examples:
Since: 3.4.0