Invisible sprites still take up a lot in memory
Just curious, if I have a sprite开发者_如何学编程 on the stage with the alpha set to 0 does that take up just as much memory as a sprite that is visible?
I imagine it does because it draws the sprite to the stage and then it has to set the alpha to zero.
It may seem like a stupid question but I just wanted to verify.
Yes, the memory footprint will be the same, and much worse, it will use up gpu/cpu resources as well, as it is, as you say, drawn to the stage, albeit invisibly.
If you don't need to display a sprite removeChild
it or set visible = false
, which neither will save up on memory, but will reduce gpu/cpu load.
精彩评论