Post

Visualizzazione dei post da settembre, 2021

How to make a Parallax Background in Unity

Immagine
Parallax scrolling is a technique in computer graphics where background images move past the camera more slowly than foreground images, creating an illusion of depth in a 2D scene of distance. In this blog you will learn how to create it using Unity. The first thing to do is have all the stuff ready for the project. In this tutorial we use a background downloadable for free from the Unity Asset Store: https://assetstore.unity.com/packages/2d/textures-materials/foggy-mountains-parallax-background-142516 Now we can start! Let's create an empty object called "Background". Check that the transform values are 0. Now drag the base image inside the object just created, in this case is the sky one, and check that the value of Order In Layout in the sprite component is 0. Then duplicate the element, and position them to the left so that the borders match, in this case set the x position to -19.2 Duplicate it again and do the same thing, but to the right, so x position to 19.2. Aft