Toggle (on/off) collisions based on setCollisionByProperty

Hi,
I need to create temporary collision layer (wall) which is showed randomly based on some boolean variable.

var showWall = true; //etc

How can I easily access and disable collision map?
It need to interfere just with player sprite and nothing else, currently I’m doing this…

layer.setCollisionByProperty({collides: true}); 

Game.scene.physics.add.collider(Game.player, layer);

I just need to do something like:
Game.scene.physics.disable.collider(Game.player, layer);

Hey Peter,
If you’re just trying to disable collision with your Player object, you can do so by setting
Game.player.body.enable = false.

Or if you would like to disable the colliders in a group you can do so like:
let children = layer.children.entries; for (let i = 0; i < children.length; i++) { children[i].body.enable = false; }

var collider = Game.scene.physics.add.collider(Game.player, layer);
// …
collider.active = false;

Ok, make sense… but I forget one thing, I actually have 2 collisions by property and I need to disable just one…

layer.setCollisionByProperty({collides: true});
layer.setCollisionByProperty({collides_dynamic: true}); // this need to be toggled on/off

Game.scene.physics.add.collider(Game.player, layer);

Hm, for that maybe you should do instead

layer.setCollisionByProperty({collides_dynamic: true}, false);

ok, my only problem is to access this layer from UPDATE file and change this property :expressionless:
How can I access layers to have setCollisionByProperty available?