I have a multiplayer game where the this.player is loaded AFTER socket.io connection is completed and I can’t do this.physics.add.collider( this.player, this.collisionLayer)
in create() as the this.player object was not yet created when create() is over.
How do I wait for this.player to be completed so that I can add collider in create() ?
I tried putting this.player.create(this.character) in preload() or create() and still the same results …
Adding this.physics.collider() in update() causes the CPU to go up really high…
Found the issue, bcos I added this.physics.add.collider in update(), it slows down the FPS and eat up a lot of memory until it ran out of memory errors and crashed.
I fixed it ( a lot of trial and errors ) by using events, once the player with socket.io load is completed, I emit an event to trigger the on event to load the collision