How create a Scrolling Background with Parallax Effect in Unity

Tristan Engel
2 min readMay 12, 2021


Here are the steps to create a scrolling background in Unity.

1. Add background to Scene
2. Duplicate (I did it twice and flipped the middle background on the X)
3. Set the new ones as childs of the 1st one
4. Align the backgrounds
5. Move the parent background (Y:-80)
6. Add the script

Infinite Scrolling Code

Use this code and add it to your Background.

[SerializeField] private float _scrollSpeed = -5f;
private Vector2 _startPos;

// Start is called before the first frame update
void Start()
_startPos = transform.position;

// Update is called once per frame
void Update()
float newPos = Mathf.Repeat(Time.time * _scrollSpeed, 80);
transform.position = _startPos + Vector2.up * newPos;

Parallax Effect

With creating multiple scrolling background with transparency you can create an parallax effect. Just set the scrolling speed of closer objects fast and the scrolling speed of far objects slow. Make sure to set order layer accordingly in Inspector. This will add some depth to you game making it look a lot better.

4 layers scrolling backgrounds



Tristan Engel

Aspiring developer that’s self-learning Unity & C# to transition to a career with Unity. I got a passion for creating interactive experiences.