Does anyone know how to paint with a texture brush? My code works but only in a square shape…I would like to add different brush textures like the terrain script. But I don’t know how to filter the alpha value of a brush texture.
var plane : GameObject; //original color
var spraytest : GameObject; //Target color
function Start () {
var texture : Texture2D = Instantiate(plane.renderer.material.mainTexture);
plane.renderer.material.mainTexture = texture;
var spraytexture : Texture2D = Instantiate(spraytest.renderer.material.mainTexture);
var TargetColor : Color[]=spraytexture.GetPixels(0,0,spraytexture.width/2, spraytexture.height);
texture.SetPixels (0, 0, spraytexture.width/2, spraytexture.height, TargetColor, 0);
texture.Apply( );
}