Coloring Individual Faces of a Cube

I’ve created a simple cube primitive and I’d like to individually change the colors of the faces ar runtime. I tried the following, but in just came out black.

// create a test cube
        m_object = GameObject.CreatePrimitive(PrimitiveType.Cube);
        m_object.AddComponent("cube");
        m_object.transform.position = new Vector3(0, 0, 0);
        m_object.transform.eulerAngles = new Vector3(60, 0, 45);

        Color[] colors = new Color[1];
        colors[0] = Color.red;

        Cubemap map = new Cubemap(128, TextureFormat.ARGB32, false);
        map.SetPixels(colors, CubemapFace.NegativeX);
        map.SetPixels(colors, CubemapFace.NegativeY);
        map.SetPixels(colors, CubemapFace.NegativeZ);
        map.SetPixels(colors, CubemapFace.PositiveX);
        map.SetPixels(colors, CubemapFace.PositiveY);
        map.SetPixels(colors, CubemapFace.PositiveZ); 

        m_object.renderer.material.SetTexture("_MainTex", map);

What’s the easiest way to accomplish this?

A cubemap isn’t for texture mapping a cube, it’s a cubed texture that you use for faking reflections in objects.

You can either UV map a cube in a certain way and set the colors of the appropriate pixels (depends on how you UV map it), or use vertex colors.

–Eric

if your less experienced with 3d modeling packages and texturing/uv mapping, you can simply extract the faces of a cube and treat each face as its own object (in Maya this action is in Polygons/Mesh/Extract). Export these six objects in one file and import in Unity. Apply unique materials to each cube face. Maybe group them in one Gameobject.