About 'Scrolling Background'!

In this video (objectives)…

  1. Add a quad and change our background image to default texture type.
  2. Create an apply a script which moves the texture offset each frame.

After watching (learning outcomes)…

Create a scrolling background by incrementing texture offset each frame.

(Unique Video Reference: 24_LD_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

Hi, an alternative to Quad method.
Put this script on your background sprite.
For your background sprite asset , in inspector, setup “Sprite Mode” => “Mesh Type” = “Full Rect”.
Warning, you need to use a bigest speed than in Quad method.
Requires at least Unity 5.6 or sup.
For a pure 2D game without 3D objects :wink:

using UnityEngine;

public class BackgroundSpriteScroller : MonoBehaviour
    [SerializeField] float scrollSpeed;

    SpriteRenderer spriteRenderer;
    Vector2 size;

    void Reset ()
        scrollSpeed = 5f;

    void Start ()
        spriteRenderer = GetComponent<SpriteRenderer> ();
        spriteRenderer.drawMode = SpriteDrawMode.Tiled;
        size = spriteRenderer.size;

    void Update ()
        size.y += scrollSpeed * Time.deltaTime;
        spriteRenderer.size = size;

Privacy & Terms