skip to Main Content
Simple Parallax
Unity

Parallaxing seems like it should be built into Unity’s 2D workflow.  Maybe by the time you are reading this it is? For everyone stuck in the now, I wanted to highlight a hidden, fantastic and lightweight parallaxing asset that’s not available on the Unity Asset store.  This collection of 2 main scripts and an editor support script was written by the team that developed Light Fall. It’s easy to setup and fun to use.

David Dion-Paquet, of the Light Fall team, explains the reasons for developing this parallaxing system in a blog post called “Creating a parallax system in Unity3D is harder than it seems” over on Gamasutra.  Even at 6 years old, Simple Parallax is the Goldilocks of Unity 2D parallaxing. It’s not too much, not too little…just right.  Read the article and download the asset below and see my complete setup guide in the Setup Guide section below.

Setup Guide

  1. Download the Simple Parallax asset from the Gamasutra article or from here and import it into your Unity Assets folder.
  2. Select your Main Camera and attach the ParallaxOption C# script to it.
  3. Check the Move Parallax option in the inspector under this newly added script.
    1. This option allows parallaxing to occur in the editor window, outside of play mode.
    2. Two convenience buttons  are included with the ParallaxOption script, Save Position and Restore Position
    3. These buttons allow you to save and restore the main camera’s editor position so you can jump back and forth between two parallaxed positions.
  4. Add sprites to your scene for your various parallax layers.  You can have as many as you like.
    1. Adjust the Order in Layer in the SpriteRenderer’s inspector settings so your images are displayed sensibly. (this doesn’t effect the parallax technically, just how the sprites sit on top of each other).
  5. For each sprite that you would like to enable parallaxing on, choose the sprites GameObject from the outliner and attach the ParallaxLayer C# script to it.
  6. You can parallax in X or Y by adding a value to the the Speed X or Speed Y inputs.
    1. These speeds will only be used when the camera is moving in the X or Y direction respectively
    2. A value of 0 is like not having the script attached at all.  The camera will move by the image normally.
    3. A value of 1 is like parenting the sprite to the camera’s position. The sprite will appear to be fixed to the camera.
    4. 0 is for objects very close to the camera
    5. 1 is for objects very far away from the camera
  7. The Move in Reverse  option is self explanatory
  8. Select the camera from the outliner while in editor mode and drag it around to test parallaxing.

Aaron Robbins

Hi. I'm Aaron, a game developer, web designer, author, illustrator, sculptor, YouTube personality and podcaster. I'm passionate about the creative process and love equipping others to make things. I run a summer coding camp for kids, teach character animation and produce a series of whimsical podcasts for families on the road.