How do I make these textures fit?

So I’m making a game and I have a ground made with two cubes. I put a texture on the cubes and changed the tiling. The problem is that when the tiling looks ok for the top of the cubes, it’s stretched out on the side of the cubes. Also the texture doesn’t repeat over the other cube. I also want to make the sides a different texture than the top.

Here’s a picture to make it a little bit easier to understand:

You can try this: Radiator Blog: The joys of using world space / procedural UVs for Unity3D

Will make all of the items with your checker textures match up perfectly (look at the brick wall picture in the link), and the sides will fix themselves. However, It doesn’t guarantee that the checkers wont cut off mid way. Though it will look much better than it currently does.