2D Infinite Vertical Background scrolling

Hello,

Im creating a game similar to Ninjump or Doodle Jump and its just gonna be one illustrated background (portrait mode). Please can anyone one help me with the code for the infinite vertical background scrolling that incorporates with the camera at the Y axis? Im coding in c#. I searched online and found nothing useful.

Thanks in advance

Two approaches here:

  • Have the background attached to the camera and set it to repeat mode. Then adjust its offset on the material while you move. Divide y-distance from the starting position of the camera by your vertical units (Camera orthosize * 2) and modulor 1
  • Create two background images. Whenever OnBecameInvisible() is called, move it up by its height