Spawning Cubes based off an image.

Hello, I am new to unity and need to use an image to spawn a grid of cubes with colours that are taken from the image. Its a 4x4 image so say the bottom line is red, red, green, black. I’d need to spawn the bottom four cubes in the grid to have the same colours, it would go red red green and then empty, as black needs to spawn nothing. As I am new to unity and scripting in general if someone could give me links to tutorials on how to accomplish this or walk me through it themselves if they have the time I would greatly appreciate it. If someone was to post a completed script of how it was done I may be able to follow it but I am unsure this would help me in the way of learning. Thanks for any help or feedback.

You can use this to analyse individual pixels in an image. Then you would probably have to do an if/else statement inside a foreach loop (with all pixels) to check if each pixel is black or not. If it’s black, you don’t want anything to happen for that pixel and if it’s not black then you want to instantiate a cube and then change it’s color to the pixels color. Good luck!