Block Types

ok so this may be a little hard to understand but I’ll give it a try.

I need the blocks to be different colors depending on the block type selected, yes all the blocks should be red (to start) but then when switching block types you can place different colors using this code:

public void DrawFace(Vector3 start, Vector3 offset1, Vector3 offset2, byte block)
{
int index = verts.Count;

verts.Add (start);
verts.Add (start + offset1);
verts.Add (start + offset2);
verts.Add (start + offset1 + offset2);

Vector2 uvBase;
switch (block)
{
default:
uvBase = new Vector2(0.25f,0.25f);
break;
case 2:
uvBase = new Vector2(0.75f,0.75f);
break;
case 3:
uvBase = new Vector2(0.25f, 0.75f);
break;
}

if ((offset1 == Vector3.right) && (offset2 == Vector3.back))
{
uv.Add (uvBase);
uv.Add (uvBase + new Vector2(0.125f, 0));
uv.Add (uvBase + new Vector2(0, 0.125f));
uv.Add (uvBase + new Vector2(0.125f, 0.125f));
}
else
{
uv.Add (uvBase);
uv.Add (uvBase + new Vector2(-0.125f, 0));
uv.Add (uvBase + new Vector2(0, 0.125f));
uv.Add (uvBase + new Vector2(-0.125f, 0.125f));
}
To realy help understand go here

and fast forward to 13:00.

This is the Tile Mat I am trying to use

1992072--128917--upload_2015-3-2_15-59-58.png


I don’t see a question here.

Is it that your entire texture is showing up, instead of just the offset to make it one color? Because you should just have to adjust the scale and offset of your texture in the material assigned to the cube to 2 to do that, and then the scripts additional offsets should handle shifting the offset to display the appropriate color.