Hello, I am working on a runner for mobile with parallax scrolling backgrounds and I had some questions about the best way to display scrolling backgrounds with the lowest impact on performance. I have tried two different setups with very different impacts on performance.
My original setup was to have the entire background cut up into as large images as possible and put together in the scene. The camera would follow the player and pan across the background without ever having to actually move it.
The second setup is largely the same and still has the moving camera and stationary background. The background is fairly simple and is mostly just a solid color that changes every few hundred pixels, so to save memory I cut up the background into several 16x16 images that served as color swatches. I made a sprite for each color section and resized the sprite X and Y (using the TK2D Sprite component in the inspector) to stretch across the length of that background segment. The end result was a change from 2 large, unscaled sprites to around 25 smaller images scaled up 45x and 50y (only 2 of which are visible on the screen at any given time). The second method resulted in a significant reduction in performance (tested on the iPhone 4). I didn't scale the sprites with Unity's transform panel so I'm really not sure why the second method performed so much worse than the first. If anything I would think that using less RAM would increase performance. Any thoughts?