Problem with adding collider

I have my tiles marked with a color to be sure that they are enabled with physics and I have the standard stuff on my sprite. When I add this line of code

this.physics.add.collider(player, worldLayer);

to enable physics, my sprite freezes. I get this error:

Uncaught TypeError: Cannot read properties of undefined (reading ‘add’)

Has anyone else had this problem?

You need to enable Arcade Physics in the game or scene config, probably.

Got that done, but I still am having trouble. Do I need to add a plugin also? - this is my first time doing anything like this.

physics: {
default: ‘matter’,
arcade: {
debug: true,
gravity: { y: 0 }
},
matter: {
debug: true,
gravity: { y: 0 },
debugShowBody: true,
debugBodyColor: 0x0000ff
}
},

plugins:  {
    scene: [
   {
    plugin: PhaserMatterCollisionPlugin.default, 
     key: "matterCollision",
     mapping: "matterCollision"
        }
     ] },

}

If you want to use phaser-matter-collision-plugin, yes, you need to download or install it.

But why it is needed to use plugin ,as this code basically using arcade physics and it is already initialized in the config.So its just an error for a reference of scene or enabling physics on gameobject.

This code needs Arcade Physics enabled in the scene, nothing else.

This code refers to a plugin that’s not included in Phaser 3.