Phaser API Documentation

  Version: 
renameTexture(currentKey, newKey)

Description:

Changes the key being used by a Texture to the new key provided.

The old key is removed, allowing it to be re-used.

Game Objects are linked to Textures by a reference to the Texture object, so all existing references will be retained.

Parameters:

name type description
currentKey string

The current string-based key of the Texture you wish to rename.

newKey string

The new unique string-based key to use for the Texture.

Returns:
Description:

true if the Texture key was successfully renamed, otherwise false.

Type:
  • boolean
Since: 3.12.0