Creating A UI Parallax Effect In Unity
Want a simple detail to boost the quality of your UI for very little work? Try a parallax effect.
Mar 24, 2022
Today’s Objective: Create a parallax effect for the UI of my Main Menu, which reacts to the mouse position.
The Existing Scene:
I currently have a Main Menu scene set up with a title, 2 buttons, and a background.
The background consists of 2 separate images: a blue sky, and a collection of buildings.
I want to add a parallax effect to the buildings so that they move slightly as the mouse moves, following its screen position.
The Code:
After creating a new class, I add some variables:
Now for the methods which create the effect: