Search Unity

How to do a looping background?

Discussion in '2D' started by ptr0x, Dec 10, 2013.

  1. ptr0x

    ptr0x

    Joined:
    Dec 9, 2013
    Posts:
    54
    Hi there, I'm trying to do a game where the player controls a plane which is constantly flying. To do so I guess I have to loop a background image but I really don't find any resources about how to do this using the new 2D stuff in the Unity 4.3.

    I appreciate very much for any kind of help.

    Thanks very much and sorry the bad english.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Depends on how you're doing the background, but assuming it's a single image, then put the image on two sprites, one next to the other. When one of the sprites scrolls out of view, move it in front of the other sprite.

    --Eric
     
  3. TheRobWatling

    TheRobWatling

    Joined:
    Feb 18, 2013
    Posts:
    45
    You can try using the texture coordinates and moving them across the object they are attached to, I used this and it gave a decent result for a scrolling background.