diff --git a/src/gameobjects/components/InWorld.js b/src/gameobjects/components/InWorld.js index 841cf89e1..a98d7597a 100644 --- a/src/gameobjects/components/InWorld.js +++ b/src/gameobjects/components/InWorld.js @@ -40,6 +40,12 @@ Phaser.Component.InWorld.preUpdate = function () { else { this.renderable = false; + + if (this.outOfCameraBoundsKill) + { + this.kill(); + return false; + } } } @@ -99,6 +105,15 @@ Phaser.Component.InWorld.prototype = { */ outOfBoundsKill: false, + /** + * If this and the `autoCull` property are both set to `true`, then the `kill` method + * is called as soon as the Game Object leaves the camera bounds. + * + * @property {boolean} outOfCameraBoundsKill + * @default + */ + outOfCameraBoundsKill: false, + /** * @property {boolean} _outOfBoundsFired - Internal state var. * @private