Jump to content

Lag When Toggling Visible


SpaceCowboy2071
 Share

Recommended Posts

Hi,

I'm creating my first project with Phaser.  I have two large background TileSprites that I want to toggle between as the game is played.  When the game state calls the create() method it creates the sprites and then sets one visible true and the other false.  After a set time, it will swap.  The first time this swap is called, there's a bit of lag.  Subsequent swaps have no lag.

I've experiencing this on my Nexus 5X and Laptop (Core i7 + GTX960M).

I'm guessing that because I almost immediately set visible to false, the second sprite isn't being rendered to the GPU.  Once it has rendered at least one time, then subsequent calls to toggle the visibility don't lag cause the texture is somehow cached.  This is all conjecture on my part, I really don't know how these things work.

Is there anyway to cache a sprite/texture to the GPU, so that toggling the visibility won't cause lag?

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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