A script for drawing on a Texture2D in Unity. Drawing is done on the CPU.
- Adjustable resolution.
- Adjustable color.
- Adjustable thickness.
- Draw straight lines.
- Draw Bezier curves.
- Add
DrawingTool.csto your Unity project. - Call
DrawLine(Vector2 start, Vector2 end)with start and end UV positions to draw. Notestartof callishould be equal toendof calli-1to draw a continuous smooth path. - Call
DrawStraightLine(Vector2 start, Vector2 end)to draw a straight line.
Note: You will need to callcurrentDrawing.Apply()manually to copy the texture to the GPU. - Call
DrawBezierCurve(Vector2 start, Vector2 end, Vector2 control)to draw a bezier curve.
Note: You will need to callcurrentDrawing.Apply()manually to copy the texture to the GPU. - See
DrawingToolExample.csfor an example of how to call the tool.
