//----------------------------------------------------------- using UnityEngine; using System.Collections; //----------------------------------------------------------- public class TexturePainter : MonoBehaviour { //Square texture with alpha to use a brush graphic for painting public Texture2D BrushTexture = null; //Width and height of destination texture on which to paint public int SurfaceTextureWidth = 512; public int SurfaceTextureHeight = 512; //Reference to painting surface texture public Texture2D SurfaceTexture = null; //Reference to material to which destination texture will be applied public Material DestMat = null; //----------------------------------------------------------- // Use this for initialization void Start () { //Create destination texture SurfaceTexture = new Texture2D(SurfaceTextureWidth, SurfaceTextureHeight, TextureFormat.RGBA32, false); //Fill with black pixels (transparent; alpha=0) Color[] Pixels = SurfaceTexture.GetPixels(); for(int i=0; i