Paint on object in editor and return as texture.

Hi, how do I make an editor script that lets you paint a color onto an mesh in the editor with the mouse without modifying the mesh, and then return the painted texture. Thanks.

Unity does not allow that, at least not without plugins. You probably want something like this: