Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

"Killed" Sprite of a "Destroyed" Group


phamedev
 Share

Recommended Posts

Hello,

1. I created a group groupA in the game.
2. I created a sprite spriteA and added it to groupA.
3. After that I kill() spriteA and keep its reference in a pool array for later use.
4. I destroy() groupA.
5. I get the spriteA from the pool array to be used in another group and try to change its texture with loadTexture(),
    I get error: 

phaser2.8.8.js:46794 Uncaught TypeError: Cannot read property 'cache' of null
    at Phaser.Sprite.loadTexture (
phaser2.8.8.js:46794)

That doesn't happen if I don't destroy the group in step 4.

Could anyone please explain what is going on and what is the right way to reuse Sprites even when their container parents are destroyed?
 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...