Spritesheet invisible after set "setPipeline('Light2D')

Hello,

I have a problem with a spritesheet loaded like this :

this.load.spritesheet('playerRed', [PlayerRed, PlayerRedN], { frameWidth: 48, frameHeight: 48, endFrame: 17 })

i use it

this.player = this.physics.add.sprite(50, 500, 'playerRed').setBounce(0.2).setCollideWorldBounds(true).setPipeline('Light2D')

Light enabled like this:

this.lights.enable().setAmbientColor('0x' + '' + this.ambiantColor)
this.playerLight = this.lights.addLight(this.player.x, this.player.y, 300).setIntensity(this.lightIntensity).setColor(0xffff00)

I dont know why, but when i set light2D on my spritesheet it become invisble.
Work perfectly without light2D…

Game configuration :

  return new Phaser.Game({
    type: Phaser.WEBGL,
    width: window.innerWidth,
    height: window.innerHeight,
    parent: containerId,
    roundPixels: false,
    input: {
      activePointers: 3
    },
    physics: {
      default: 'arcade',
      arcade: {
        gravity: { y: 1300 },
        debug: false
      }
    },
    scene: [BootScene, PlayScene]
  })

You can view the spritesheet in attachment :slight_smile:

thank you in advance

playerRed_n playerRed

Hi @Vaunt ,
I can think of two possible causes:

  1. You are using the Phaser version 3.50.
  2. There is a typo in the variable this.ambiantColor (this.ambientColor ?).

Hi @jjcapellan,

Thx for your answer,

I’m using :

"phaser": "^3.24.1",

and for ambient color (no typo), i have also tried without variable and like this : 0x111111

this.ambiantColor = 111111

But yes, the variable have a typo

In my current game the Light2D work with :

- tilemapTiledJSON
- Image

But not with spritesheet

You can see a screen of my game here.

Even the official example seems not to work with the spritesheet (some faces should appear):

Yes :frowning:

Do you think there is another solution?

Maybe, but I don’t know it. Sorry.

1 Like

You can use a texture atlas instead.

Or you can switch to v3.50.0-beta.9 (you have to build it).

Use a Texture Atlas. Sprite Sheets don’t work with normal maps.

Don’t switch to 3.50, I’m not convinced it’s worth keeping Light2D in there yet, so it may be dropped from the release.