In my Unity 2D Game, I need to move some items in the background, including:
- Pavement
- Street Lights
- Buildings
Then it feels like the player is moving. But actually, the items are moving backward.
Have a look at this video:
It'd be great if we automatically spawn these items & move. That's where we can get some help from a C# script. Here's how to do that:
- Create a script called "InfiniteMovingBelt.cs" in your project
- Then add the following content
- Then Create an "Empty Game Object" and add this script
After that, customize the parameters of this script as shown in the above video.
Better Solution
Since this might be a common task in 2D games, I think there is a much better solution than this. If you know a better solution, just let me know.
Top comments (0)