How to create an infinite 2D map in Unity?

2D infinite map in unity

Hello Guys!  Hope you have set your new year resolutions and have gone to the gym on 2nd of jan as well.

Well, it has been quite some time and this was one of the pending tutorials we are yet to discuss. So let us kick off this year with this fresh tutorial on making infinite 2D maps in Unity.

Making infinite maps are a necessity. You must know it as endless runner games are so common these days and earning mindless revenues. They have emerged as one of the most addictive game categories in the app stores. You can create an infinite map in Unity by employing repeated texture and set offset texture. You can loop the texture infinite times to create an infinite map.

Repeated texture will have the same start and end point that creates the perception of an endless loop for the player. You can set the values in the inspector as shown here in this free unity scripting tutorial.

Set the texture type to ‘advanced’, set the wrap mode at ‘repeat’. This makes Unity engine repeat the texture infinite times. Create a material in the project panel set shader to ‘unlit/texture’. Create quad in hierarchy panel and apply the material n quad. After that is done, you need to set texture offset. Refer the unity3d game source code to set the variables to the desired values. You are done.

Hope you enjoyed the tutorial and successfully created your own infinite 2D map in unity. Wish you a great year ahead.

We will be back with more tutorials on 2D development soon. Till then, stay busy and get things done. Cya!

Related: How to create snowing effect in Unity3D using shaders?

Leave a comment