Changing color of specific pixels of a sprite on Mouse Drag.

Hi all,

I am somewhat new to Unity and can’t manage to tackle this problem, despite all my efforts. I have a 2d Sprite which is rendered in a color (let’s say red as an example). The idea is that once the user drags his mouse over this sprite (I managed to get this part to work), the color of the pixel at the mouse position changes to another color, say white. This way a sort of shading effect is created.

So far I have managed to change the color of the whole sprite in a OnMouseDrag() function. I have tried utilizing Ray and RaycastHit, but with no luck so far.

Any ideas on this? Thanks

Check out this thread: