- Home /
Add multiple sprites to a background game object
I have a background GameObject. This is comprised of multiple sprites and I want them laid out in a horizontal linear fashion like Super Mario Bros.
At run time if the gameObject has an array of sprites how can display these? Do I use the position find the width for do I need to create game object programatically?
Answer by zero_null · Dec 28, 2017 at 07:34 AM
The question is too wide to be answerable. There are multiple ways of creating a 2d platformer side scroller game. You can either stack the sprites in the horizontal manner but only if you have a fixed size game level. Or else you can create a system where the sprites can move from right to left to create and illusion of scene movements. Please have a look at parallax scrolling for infinite side scroller 2d platformer game.
https://unity3d.com/learn/tutorials/topics/2d-game-creation/2d-scrolling-backgrounds http://pixelnest.io/tutorials/2d-game-unity/parallax-scrolling/
Thanks for the answer. The second link was great.
I had a few issues, but ultimately it was I was setting the GameObject to the parents transform and the layer was off.
Your answer
![](https://koobas.hobune.stream/wayback/20220612145345im_/https://answers.unity.com/themes/thub/images/avi.jpg)