Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BackgroundScroll : MonoBehaviour
- {
- private Material quadMaterial;
- private Vector2 offset;
- [SerializeField] private int xVelocity;
- [SerializeField] private int yVelocity;
- // Start is called before the first frame update
- void Start()
- {
- quadMaterial = GetComponent<Renderer>().material;
- offset = new Vector2(xVelocity, yVelocity);
- }
- // Update is called once per frame
- void Update()
- {
- quadMaterial.mainTextureOffset += offset * Time.deltaTime;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement