Advertisement
maxhacker11

ParallaxLayer.cs

Jul 23rd, 2023
10,843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.31 KB | Source Code | 0 0
  1. using UnityEngine;
  2.  
  3. [ExecuteInEditMode]
  4. public class ParallaxLayer : MonoBehaviour
  5. {
  6.     public float parallaxFactor;
  7.  
  8.     public void Move(float delta)
  9.     {
  10.         Vector3 newPos = transform.localPosition;
  11.         newPos.x -= delta * parallaxFactor;
  12.  
  13.         transform.localPosition = newPos;
  14.     }
  15.  
  16. }
  17.  
Tags: Unity
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement