- Home /
Drawing on a plane in Unity
I wanted to create a drawing tool in Unity, something akin to the brush in MS Paint. I want to apply a colour on a white plane at the mouse cursor position.
I've never done anything like this and I was wondering what would be the best approach for applying the colour.
I was thinking about 2 possible approaches:
Create a new GameObject with the
Line Renderercomponent for each "stroke" and add points to theLine Rendererin certain intervals of time or distance.Spawn GameObjects with the
Sprite Renderercomponent that would have a sprite resembling a paint drop in certain intervals of time or distance.
Am I on the right track with the approaches that I came up with? Is there an easier solution that I am missing?
Answer by Unshackled · Jul 15, 2019 at 06:06 AM
The closest thing Iv done to this is top-down view of 100 cubes or so, all arranged neatly in a grid. I then had invisible sphere follow the mouse. Gave the sphere a tag, then gave all the cubes a simple script saying if they touched the sphere and the mouse was held down then change colour. It was more like pixel art.
Sorry if this doesn't help but maybe will give you food for thought.
Your answer
Follow this Question
Related Questions
Drawing, Writing on screen. 1 Answer
determine how much space is left on screen 1 Answer
DrawMesh always drawn before gameobjects 1 Answer
create line on a texture 2 Answers