Skip to main content

Magic Paint



  • Set textures(brushes and the texture for painting).



  • Drag the “Magic Paint” prefab into scene. Drag the texture for painting to the “Paint Texture” variable in inspectorAnd than,click the “Create Magic Paint” button.




3.Fuctions.
void Pause()
void Resume()
Pause and resume

void Clear(Color32 color)
void Clear( )
Clear the texture for painting by color

void Color32 GetColor()
void SetColor(Color32 color)
void SetColor(Color32 mainColor, Color32[] subColors)
Get and set color

Texture2D GetPaintTexture()
void SetPaintTexture(Texture2D tex)
Get and set the texture for Painting

byte[] PreReadTex(Texture2D tex)
Preload the brush texture if the texture ‘s size is too large.

void SetParticle(GameObject particlePrefab = null)
void SetAudio(AudioClip audioClip = null)
Set the particle and the audio

void UsePencil(int brushSize = 5)
void UsePencil(Color32 color, int brushSize)
Use pencil

void UseBrush(Texture2D tex)
void UseBrush(Texture2D tex, Color32 color)
Use brush

void UseRainbow(Texture2D tex)
void UseRainbow(nt brushSize)
Use rainbow

void UseSpray(Texture2D tex)
void UseSpray(Texture2D tex, Color32 color)
Use spray

void UseScatter(Texture2D tex)
void UseScatter(Texture2D tex, Color32 color)
void UseScatter(Texture2D tex, Color32[] colors)
Use scatter.And you can custom colors.

void UseScatterPro(Texture2D tex, Color32 color,
float rotateValue, float scaleValue)
void UseScatterPro(Texture2D tex, Color32[] colors,
float rotateValue, float scaleValue)
void UseScatterPro(Texture2D[] texes, Color32 color,
float rotateValue, float scaleValue)
void UseScatterPro(Texture2D[] texes, Color32[] colors,
float rotateValue, float scaleValue)
Use scatterpro.You can set the rotation and scale from 0 to 1.And you can also use mult-brushes.

void UsePaster(Texture2D tex, bool autoPaster = true)
void Paster(Vector3 pos, float delay = 0)
Use paster.You can paster a texture to a position by “Paster” fuction if
the “autoPaster” is false.

void UseRail(Texture2D tex, int brushSize = 20)
void UseRail(Texture2D tex, int brushSize, Color32 color)
void UseRail(byte[] pixels, int brushSize = 20)
void UseRail(byte[] pixels, int brushSize, Color32 color)
Use rail by brush texture’s alpha channel.If texture is too large,you can use the “PrereadTex” fuction first.

void UseSand(Texture2D tex, int brushSize = 20)
void UseSand(Texture2D tex, int brushSize, Color32 color)
void UseSand(byte[] pixels, int brushSize = 20)
void UseSand(byte[] pixels, int brushSize, Color32 color)
Use sand by brush texture’s grey level.If texture is too large,you can use the “PrereadTex” fuction first.

void UsePattern(Texture2D tex, int brushSize = 20)
void UsePattern(Texture2D tex, int brushSize, Color32 color)
void UsePattern(byte[] pixels, int brushSize = 20)
void UsePattern(byte[] pixels, int brushSize, Color32 color)
Use pattern by brush texture’s original pattern.If texture is too large,you can use the “PrereadTex” fuction first.

Comments