Skip to content

Commit 90e1460

Browse files
committed
Added new Debug.displayList function.
1 parent 99aeae5 commit 90e1460

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/utils/Debug.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,39 @@ Phaser.Utils.Debug.prototype = {
836836

837837
},
838838

839+
/**
840+
* Call this function from the Dev Tools console.
841+
*
842+
* It will scan the display list and output all of the Objects it finds, and their renderOrderIDs.
843+
*
844+
* **Note** Requires a browser that supports console.group and console.groupEnd (such as Chrome)
845+
*
846+
* @method displayList
847+
* @param {Object} [displayObject] - The displayObject level display object to start from. Defaults to the World.
848+
*/
849+
displayList: function (displayObject) {
850+
851+
if (displayObject === undefined) { displayObject = this.game.world; }
852+
853+
if (displayObject.hasOwnProperty('renderOrderID'))
854+
{
855+
console.log('[' + displayObject.renderOrderID + ']', displayObject);
856+
}
857+
else
858+
{
859+
console.log('[]', displayObject);
860+
}
861+
862+
if (displayObject.children && displayObject.children.length > 0)
863+
{
864+
for (var i = 0; i < displayObject.children.length; i++)
865+
{
866+
this.game.debug.displayList(displayObject.children[i]);
867+
}
868+
}
869+
870+
},
871+
839872
/**
840873
* Destroy this object.
841874
*

0 commit comments

Comments
 (0)