public GameObject redCube;
public GameObject blueCube;
public GameObject yellowCube;
public GameObject greenCube;
public Texture2D importTexture;
private Color[] pixels;
// Use this for initialization
void Start () {
CreateWorld();
}
void CreateWorld()
{
pixels = importTexture.GetPixels(0, 0, importTexture.width, importTexture.height);
for (int x = 0; x < importTexture.width; x++)
{
for (int z = 0; z < importTexture.height; z++)
{
Color color = pixels[(x * importTexture.width) + z];
if (color == Color.red)
{
Instantiate(redCube, new Vector3(x * 2.0f, 0.0f, z * 2.0f), Quaternion.identity);
}
else if (color == Color.blue)
Instantiate(blueCube, new Vector3(x * 2.0f, 0.0f, z * 2.0f), Quaternion.identity);
}
}
}
}
Is this a surface shader or a regular vert/frag shader? From memory surface shaders don't work well with Blit: https://forum.unity3d.com/threads/shaders-not-working-in-graphics-blit-when-using-my-own-rendertexture.98161/
– tanoshimi