Do hidden layers affect game performance? The objects are created but hidden on layers, then the layers hidden or shown when needed.
Is it better to create the objects as you need them?
Just because they are invisible, doesn't mean they might not still be checking for collisions, calculating their current positions etc...so I guess it depends on the situation (especially behaviors and events involved)
I guess the best way to find out for sure would be to create a really exaggerated benchmarking project with an on-screen FPS counter.. starting with 2 visible layers loaded with sprites, and the ability to hide or destroy one of the layers...you might also want to make it so you could also start all the sprites on the hidden layer to start rotating and/or moving as well. This should answer your question in no uncertain terms.. I also suggest testing this benchmarking program on your target devices to see if the deference is more extreme on any given platform.
Best of luck,
Develop games in your browser. Powerful, performant & highly capable.
Yeah I was just wondering if anyone knew how it was handled or had looked into it before.
The best answer to any performance question is always just to measure it and see.
If you want to increase performance I guess creating all your events in groups could help a lot, so any specific action will be read only when necessary