I’m trying to use this code to draw to an existing texture on a model I have. The question I have is on my shader I have different textures. I have the main texture and another one called Texture2. How can I access the Texture2 using the code below instead of mainTexture? I could swap the textures before I run the code below, but the user would see the texture swap, thats worse case scenario if there is no way to access the other texture in Texture2.
I looked at
var tex : Texture2D = renderer.sharedMaterials[0].mainTexture;
var pixelUV = hit.textureCoord2;
pixelUV.x *= tex.width;
pixelUV.y *= tex.height;
tex.SetPixel(pixelUV.x, pixelUV.y, Color.black);
tex.Apply();