Context sensitive tiled infinite background

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By testeria

I made simple infinite background with this tutorial:

Now I want something little more complicated: I want the texture image to change depending on game context. I can do this with white flash transition effect (flash to white, change texture, white to normal) but it would be much more useful if it could slide in sticked to previous background. That way I could introduce new places on the way (mountains, then forest, then village, like this).

Not sure what is the best way to create this kind of effect.

I could stop animation, slide texturerect off screen and at the same time slide in another texturerect one with different background. Then reuse offscreen one for the next transition - but that feels little clumsy. Is there a better way to get this effect? Maybe I should slice my backgrounds into tiles and go more in procedural generation(Tile-based Infinite background)?

Thanks for any tips.