EDIT 1 Here is how I apply uv
` public static Dictionary<string, Vector2[]> textureMap = new Dictionary<string, Vector2[]>();
public static void Initialize(string texturePath, Texture texture)
{
Sprite[] sprites = Resources.LoadAll<Sprite>(texturePath);
foreach (Sprite s in sprites)
{
Vector2[] uvs = new Vector2[4];
uvs[0] = new Vector2(s.rect.xMin / texture.width, s.rect.yMin / texture.height);
uvs[1] = new Vector2(s.rect.xMax / texture.width, s.rect.yMin / texture.height);
uvs[2] = new Vector2(s.rect.xMin / texture.width, s.rect.yMax / texture.height);
uvs[3] = new Vector2(s.rect.xMax / texture.width, s.rect.yMax / texture.height);
//Debug.Log(s.name);
if (!textureMap.ContainsKey(s.name))
{
textureMap.Add(s.name, uvs);
}
}
}
public static bool AddTextures (Block block, Direction direction, int index, Vector2[] uvs)
{
string key = FastGetKey(block, direction);
Vector2[] text;
if (textureMap.TryGetValue(key, out text))
{
//Debug.Log(key);
uvs[index] = text[0];
uvs[index + 1] = text[1];
uvs[index + 2] = text[2];
uvs[index + 3] = text[3];
return true;
}
text = textureMap["Default"];
uvs[index] = text[0];
uvs[index + 1] = text[1];
uvs[index + 2] = text[2];
uvs[index + 3] = text[3];
return false;
}
`
Where Direction is a direction (example north) and Block is a short. Index is the vertex index of the mesh. Texture is the sprite texture (.png)


