Seamless Tile Textures
When I first started developing The Last AntLion, I really didn't care how the textures looked because I was more focused on having a functioning game than having a game that looked good but wasn't playable. However, as the game progressed and the level became larger, I found it more and more difficult to continue building the environment without having a set of textures that tile seamlessly. Basically, I needed to create a library of textures for things like sand, dirt, ladders, pits, etc.
Here's what the new, updated sprite sheet textures look like so far:
The game used to look like this:
...now it looks like this:
As you can see, it's much cleaner and already looks a thousand times better than the boring, solid colors. However, even with the new sprite sheet, I ran into a new problem: Vertex Snapping.
As you build a level with seamless tiles, you expect everything to just line up when you snap them together with a technique known as "Vertex Snapping" in the Unity Game Engine. Unfortunately, I noticed that some tiles had a slight gap between them and no matter how many times I used Vertex Snapping, they would never be close enough to get rid of the gap.
See the gap?
I was getting really frustrated with these random gaps, especially since I had over 1000 tiles and going one by one checking each of them became tedious and annoying. These gaps didn't happen all the time, only on random textures, here and there... it was very hard to pinpoint exactly what I was doing wrong. I spent hours searching online for solutions, but nothing anyone suggested seemed to fix it.
Finally, I found a setting in Unity called "Snap Settings", which are different from Vertex Snapping. It was buried in the Edit --> Snap Settings menu drop down. It looks like this:
I selected every tile in my game and pressed the "Snap All Axes" button. Suddenly ALL of my textures were perfectly connected to each other. No strange gaps. I couldn't believe it was so simple.
That's what I love about game development. You run into a headache that you perceive as a huge roadblock, but if you are persistent and continue to learn more about the endless tools in the Unity Game Engine, you WILL find a way to fix your issue. It might take a while, sometimes hours or days to come to a solution...but what's the alternative? Give up? Nope. You must press on. You are a game developer. This is your passion, your hobby, your life.
If this posts helps at least 1 person understand how to fix this problem in there game, then this blog was a success. Thank you for taking the time to read it. Until next time!
The Last AntLion