How can I achieve this kind of shading?

I’ve searched allot for this kind of shading, it colors every face with a different color:

http://imagine.inrialpes.fr/people/Francois.Faure/htmlCourses/WebGL/meshes/cube36.html

but the site didn’t supply the source code!

What I want to do here is to use this kind of shading for mobile, not webGl.

There are several ways. Unity’s default cube mesh has mapped each face to the whole texture, at least in the first UV channel. The second UV channel maps each face to a different portion of the texture. So you can use a custom shader that simply uses the second UV channel (UV1) instead of the first(UV0) or create your own mesh where you map the first channel the way you like.

In case you don’t want to use any textures but simply assign a single color to each face, you can use a shader that uses vertex colors and use a mesh that has it’s vertex colors set appropriately. I’ve recently posted 3 simple opaque shaders which use vertex colors.

A third way (without changing the mesh and using the default cube mesh) is to write a shader that chooses a vertex color based on the vertex normal direction.

Btw the site you have linked is not made with Unity. The source code can simply be read. Though it’s just a usual WebGL project written in (web)JavaScript. Just have a look at source of the webside. In FireFox just press CTRL+U. The shader code (as GLSL shader) is right there as well as all the rendering and setup code. The actual cube mesh (with it’s vertex colors) is defined in a seperate javascript file(cubePoints.js). Though this probably won’t help you much if you want to do this in Unity.