I am trying to achieve tiling with mesh. I manage to get it working but I have odd problem with textures. On edges there are sometimes lines which shouldn’t be there, the thing is its not on every tile like that, and if I move the camera it disappears from one place and it shows up on another place.
Pictures: Picture 1, Picture 2. And here is the code I use for applying texture to a mesh:
newUVs.Add(new Vector2(tileSize * texture.x, tileSize * texture.y + tileSize));
newUVs.Add(new Vector2(tileSize * texture.x + tileSize, tileSize * texture.y + tileSize));
newUVs.Add(new Vector2(tileSize * texture.x + tileSize, tileSize * texture.y));
newUVs.Add(new Vector2(tileSize * texture.x, tileSize * texture.y));
tileSize is 0.32f in my example. texture is Vector2(Grass texture is 0,0 and Dirt texture is 1,0). I really have no idea how to fix it anymore. I tried bunch of stuff but same thing.