How to texture blocks in a way similar to Minecraft?

So I’m new and really liking the engine. I’m currently just playing around with and trying new things. I’v been playing around making a map out of cubes for fun and it looks great but I want to find out how to texture them. I know about materials and how they basically work in unity but when I put a simple texture on a block I get the same thing on each side or reversed or otherwise.

My goal has to been to make the blocks sort of look like they do in minecraft. That being 4 of the 6 sides of the cube have the same part of the texture while the top (don’t really care about the bottom) has a different part of the texture wrapped onto it. Such as a grass block I think?

Another way of asking this is if we think of a cube like a dice I want the top being side 1 to differ from sides 2-5. If a texture is a flat picture, how do I wrap it around my block in such a way that it covers it how I want it?

Any help would be great, in editor or scrips if I have to.
I AM NOT MAKING MINECRAFT!!! I am just using that as an example for how I want my blocks to look. No tile mapping or block behavior necessary. Thanks for hopefully understanding.

Google: UV map

Basically you don’t texture the whole cube, you texture each face that makes up the cube separately. If your cubes are primitive cube Game Objects, then I don’t (think) you can do it this way although I’m not sure. I don’t do mine that way.

But you could maybe make a cube out of primitive quad objects and texture each of those (and parent them together). You would want that whole cube being a single mesh, though. There are assets for this…

In a Minecraft-like game, you generate your faces procedurally and assign the texture procedurally. You have a big tile sheet with all your textures. You use UV mapping to select a section of that tile sheet to be put on a specific face.

There’s kind of a lot to it, it’s hard to answer without knowing exactly how you’re making your game.

Here is a complete sample code for a Minecraft-like chunk mesh generation including adding and deleting blocks. I have used it as a base for my game myself and customized it to my own needs. It’s easy to understand so I suggest you take a look. There are many other similar scripts around.

Dummycraft