Advertisement

Unity 2D

Started by June 08, 2022 09:57 PM
1 comment, last by tcemalpaydin 2 years, 6 months ago

I'm creating a 2D game where there are different backgrounds. I need to know about a feature where the different backgrounds can repeat one after another randomly.

I created different backgrounds in the game so I want a situation where the backgrounds will loop between each other. I mean, I will just follow each other, since it is an endless game I will like to separate the backgrounds and make it in a way that that background 2 will follow background 4 and just switch between backgrounds.

So that's what I mean, I hope you all understand.

I am using Unity and work with C#, the 2D game is not a tile game and I want the backgrounds to swap with each other and not for the background to follow the order in which they are built: I want them to swap, like, 1 to 3, then 5 to 2 to 4 to 3 to 2 to 1 and so on.

Advertisement

A better practice would be to generate an entire track before each session, but you could always make small random generated checks to instantiate your backgrounds.

This topic is closed to new replies.

Advertisement