O'Reilly logo

Unity 5.x Game Development Blueprints by John P. Doran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making a repeating background

Of course, we could have the background remain static throughout the project, but that would get boring rather quickly and the plane will not appear to actually be moving. Instead, to make the game more visually interesting, let's have the background move to make the player's plane appear to be flying:

  1. From the Project tab, open the Scripts folder and then select Create | C# Script. Name the newly created script RepeatingBackground.
  2. Double-click on the script file to open it up in your IDE of choice and use the following code:
    using UnityEngine; public class RepeatingBackground : MonoBehaviour { [Tooltip("How fast should this object move")] public float scrollSpeed; /// <summary> /// How far to move until the image is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required