Jump to content

Lag When Toggling Visible


Recommended Posts


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?


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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