Raycasthit.textureCoord not painting colored pixels

I’m a beginner to Unity and have been fiddling around with it for the last few days. The end goal for me is to create a clickable world map as described here. The instructions on that page is what led me to initially try using Raycasthit.textureCoord to paint a the clicked portion of my map a certain color.

Right now, I’m just using a 5x3x1 cube with a plain white texture attached to it. As mentioned in the documentation, I’ve attached a mesh collider to the cube. Also, the script with the Raycasthit.textureCoord code is attached to the camera as instructed (it is copy + pasted from the documentation). I understand for the most part what the code means, (after reading into all the variables and types), but I don’t seem to understand why it’s not doing what it’s supposed to do (no console errors in sight).

Any help or direction would be appreciated!

I just tested the script in the reference. I found it had a couple of problems to be fixed before it would run, but it ran and worked. Note it is likely this script will make permanent changes to the texture. I use a Quad with Unlit/Texture shader and set the texture to something bright.

As for your goal, I’ve used similar code and it works well. The only caution is don’t try and match colors exactly. Allow some leeway when detecting colors and mapping them.