How can I move a sprite/texture left for a couple of seconds or to a certain position, then return it back to it’s original position(where it starts)? The reason I want to do this is because my background scrolls to the left, but when it scrolls off screen the scene background becomes blue and bland because the clouds have scrolled off screen. My texture that I have consists of clouds and a blue background, but it only looks like the clouds move so again they move off screen and reset but they take a while and I don’t want to increase the speed of it because then it will look too fast.
So, my texture scrolls but doesn’t actually move. I want something that will actually move my textures/sprites. If your curious as to how my background scrolls, here’s my script:
public class BackgroundScroller : MonoBehaviour {
public float speed = 0;
public static BackgroundScroller current;
float pos = 0;
void Start(){
current = this;
}
void Update(){
pos += speed;
if(pos > 1.0f)
pos -= 1.0f;
renderer.material.mainTextureOffset = new Vector2(pos, 0);
}
}