The InputController class is a singleton component responsible for managing user input.
Properties & Fields
Member
Description
publicintMaxTouchesCount{...}
specifies the maximum number of touches allowed for simultaneous drawing.;
publicInputMethodsActiveInputMethods{...}
defines active input methods: VRMode, Pen, Touch, Mouse. All input methods are enabled by default;
publicIList<Canvas>Canvases{...}
holds a list of canvases that should ignore raycasts, preventing painting on their child objects;
publicboolBlockRaycastsOnPress{...}
determines if painting should be blocked when hovering over canvas items;
publicGameObject[]IgnoreForRaycasts{...}
GameObjects to ignore raycasts (children objects of Canvas that won't prevent painting);
publicTransformPenTransform
Transform of Pen/Hand for painting, used for VR painting;
publicfloatMinimalDistanceToPaint
minimal distance from Pen to surface to perform painting, used for VR painting;
Events
Event
Description
publiceventAction<int,Vector3>OnMouseHover
triggered when the mouse hovers over an object;
publiceventAction<int,Vector3,float>OnMouseDown
triggered when a left mouse click occurs on an object;
publiceventAction<int,Vector3,float>OnMouseButton
triggered while the left mouse button is held down over an object;
publiceventAction<int,Vector3>OnMouseUp
triggered when the left mouse button is released over an object.
RaycastController
The RaycastController class is a singleton responsible for handling ray intersection checks with triangles and storing data about all objects available for raycasting.
Properties & Fields
Member
Description
publicboolUseDepthTexture{...}
determines whether to use a Depth Texture for raycasting, useful when multiple PaintManagers are active in a scene. If using SRP, DepthTexture must be enabled in URP/HDRP settings
checks if a ray intersects any triangles and returns the corresponding raycast data.
PaintController
The PaintController class is a singleton that manages all PaintManagers. It provides shared settings for all PaintManagers when the “Use Shared Settings” flag is enabled; otherwise, each PaintManager uses its own settings.
Properties & Fields
Member
Description
publicboolOverrideCamera{…}
determines if the camera used for raycasts should be overridden;
publicCameraCamera{…}
reference to the camera used for raycasting;
publicboolUseSharedSettings
specifies whether shared settings for brush, paint mode, and tool should be used across all PaintManagers;
returns all registered PaintManagers as IEnumerable.
PaintManager
PaintManager
The PaintManager class is the core component for managing painting operations on objects. It contains instances of the Paint class and the BasePaintObject.
returns the final texture (combined layers); hiding the brush preview is optional; ensure proper disposal of the texture to avoid memory leaks;
publicSetLayersData(LayersContainercontainer)
sets layer data;
publicLayerData[]GetLayersData()
returns the current layer data;
publicboolIsLayersContainerExists(stringfilename)
checks whether the LayersContainer exists on storage by filename;
publicboolSaveToLayersContainer(stringfilename)
saves the LayersContainer to storage, returning true on success;
publicboolDeleteLayersContainer(stringfilename)
deletes the LayersContainer from storage, returning true on success;
publicboolLoadFromLayersContainer(stringfilename)
loads the LayersContainer from storage, returning true on success;
publicvoidInitBrush()
initializes the brush settings;
publicRayGetRay(Vector3screenPosition)
returns Ray from screen position.
BasePaintObject
The BasePaintObject class is the foundation for painting on RenderTexture. Derived classes, such as CanvasRendererPaint, SpriteRendererPaint, MeshRendererPaint, and SkinnedMeshRendererPaintObject, implement logic for checking painting positions based on input data.
Properties & Fields
Member
Description
publicboolInBounds{…}
property indicating whether the user’s object is within bounds for painting;
publicboolIsPainting{…}
property indicating whether the user is actively painting;
publicboolIsPainted{…}
property indicating whether painting has occurred in the current frame;
publicboolProcessInput
property indicating whether input processing is active for the current paint object;
Events
Event
Description
publiceventAction<PointerData>OnPointerHover
mouse hover event. Arguments: PointerData that contains paint object local position, screen position, UV position, texture position, pressure, finger id;
publiceventAction<PointerData>OnPointerDown
mouse down event. Arguments: PointerData that contains paint object local position, screen position, UV position, texture position, pressure, finger id;
mouse up event. Arguments: PointerUpData that contains screen position, is mouse in object bounds, finger id;
publiceventAction<DrawPointData>OnDrawPoint
draw point event, used by developers to obtain data about painting. Arguments: DrawPointData that contains the texture position, pressure, and finger ID;
publiceventAction<DrawLineData>OnDrawLine
draw line event, used by developers to obtain data about painting. Arguments: DrawLineData that contains the start and end texture positions, start and end pressure, and finger ID;
creates a mask for the layer using the specified texture and format;
publicvoidRemoveMask()
removes the mask from the layer;
publicvoidSaveState()
saves the state of the layer’s render texture using the StatesController;
publicvoidDoDispose()
releases all layer data.
Paint
The Paint class stores and manages painting material data and its parameters.
Properties & Fields
Member
Description
publicMaterialPaintMaterial{…}
the material used for painting;
publicMaterialPaintWorldMaterial{…}
material used for painting in PaintSpace.World;
publicstringShaderTextureName{…}
the name of the shader texture used for painting;
publicintDefaultTextureWidth{…}
width of the texture if the object doesn’t have a source texture;
publicintDefaultTextureHeight{…}
height of the texture if the object doesn’t have a source texture;
publicColorDefaultTextureColor{…}
default color for the texture;
publicProjectionMethodProjectionMethod{…}
determines the method used to project the brush texture onto the surface. Usage: Planar Projection projects along the brush normal for flat/slightly curved surfaces; Triplanar Projection blends across X/Y/Z planes for varied orientations.
publicProjectionDirectionProjectionDirection{…}
determines how the brush normal is calculated for texture projection. Usage: Normal uses triangle normals; Ray uses the raycast direction.
publicfloatNormalCutout{…}
parameter that ensures paint isn’t applied where the surface’s normal angle is too steep compared to the paint ray, helping avoid painting areas that face away from the painting ray in PaintSpace.World. Usage: −1.0 no culling; 0.0 discards surfaces facing away; 1.0 only faces directly toward the viewer.
publicfloatProjectionMaxAngle{…}
specifies the maximum angle between brush normal and fragment normal; controls how much the brush wraps around curved surfaces in PaintSpace.World;
controls how Max Angle affects alpha. Usage: Smooth attenuation for gradual blending; Hard cutoff for precise angular limits.
publicfloatProjectionBrushDepth{…}
controls the depth (thickness) of the brush effect along the brush normal direction, relative to brush size. Usage: 0.0 disables depth attenuation; values > 0.0 limit influence to a volumetric range.
publicfloatProjectionDepthFadeRange{…}
defines the range over which the brush effect fades from full strength to zero across the depth defined by Brush Depth;
publicfloatProjectionEdgeSoftness{…}
controls the softness of brush edges, affecting alpha falloff toward the outer radius in PaintSpace.World. Usage: 0.0 hard edge; values > 0.0 apply exponential falloff.
sets the brush texture and optionally renders it, sends the event, and updates the RenderTexture.
ToolsManager
The ToolsManager class manages all the tools available for painting within the PaintManager. It handles the registration and selection of painting tools.
Properties & Fields
Member
Description
publicIPaintToolCurrentTool
returns the current tool;
Events
Event
Description
publiceventAction<IPaintTool>OnToolChanged
event triggered when the current tool is changed. Arguments: IPaintTool representing the new tool;
Methods
Method
Description
publicvoidInit(PaintManagerpaintManager)
initializes the ToolsManager for the given PaintManager and subscribes to its events;
publicvoidDoDispose()
releases all tool-related resources;
publicvoidSetTool(PaintToolpaintTool)
sets the specified tool as the active tool;
publicIPaintToolGetTool(PaintTooltool)
retrieves the tool based on the PaintTool type.
BasePaintTool
The BasePaintTool class is the base class for all painting tools. It processes layer textures using input events from the PaintManager.
Properties & Fields
Member
Description
publicvirtualPaintToolType{…}
type of the tool;
protectedIPaintDataData
data that the tool has to process an image. Used to get information about layers, RenderTextures, Brush, painting states;
publicvirtualboolAllowRender{…}
indicates whether rendering is allowed;
publicvirtualboolCanDrawLines{…}
indicates whether the tool can draw lines. If false, the user can only draw dots;
publicvirtualboolConsiderPreviousPosition{…}
determines whether the brush should render if the previous paint position hasn’t changed;
publicvirtualboolShowPreview{…}
flag indicating whether to show the brush preview;
publicvirtualintSmoothing{…}
smoothing level for line drawing, values range from 1 to 10, where 1 disables smoothing and 10 provides maximum smoothness. Affects SpriteRenderer and RawImage components;
publicvirtualboolRandomizePointsQuadsAngle{…}
indicates whether to randomize angles of quads when drawing points;
publicvirtualboolRandomizeLinesQuadsAngle{…}
indicates whether to randomize angles of quads when drawing lines, useful for simulating spray tool behavior;
publicvirtualboolRenderToLayer{…}
indicates whether to render to the layer texture;
publicvirtualboolRenderToInput{…}
indicates whether to render to the input texture;
publicvirtualboolRenderToTextures{…}
indicates whether to render to any RenderTextures;
publicvirtualboolDrawPreProcess{…}
indicates whether to perform pre-processing before drawing;
publicvirtualboolDrawProcess{…}
indicates whether to perform drawing during the process;
publicvirtualboolBakeInputToPaint{…}
determines whether to bake the input texture to the layer texture;
publicvirtualboolProcessingFinished{…}
returns whether the tool has finished processing;
publicvirtualboolRequiredCombinedTempTexture{…}
indicates whether the tool requires a temporary combined texture;
publicBasePaintToolSettingsBaseSettings{…}
reference to the base settings of the tool;
publicTSettings{…}
reference to the specific settings class of the tool;
dperforms drawing when combining layers into the combined texture.
BasePaintToolSettings
The BasePaintToolSettings class is the base class for settings of all tools. Each tool can have its own derived settings class.
Properties & Fields
Member
Description
publicboolCanPaintLines{…}
indicates whether the tool can draw lines. If false, the user can only draw dots;
publicboolDrawOnBrushMoveOnly{…}
determines whether the tool renders the brush only if the previous paint position has changed;
publicintSmoothing{…}
defines the smoothing level for line drawing, values range from 1 to 10 (where 1 disables smoothing and 10 provides maximum smoothness). In the case of values greater than 1, line painting performs with a 2-frame delay. This parameter affects SpriteRenderer and RawImage components;
publicboolRandomizePointsQuadsAngle{…}
indicates whether to randomize the angles of quads while drawing points;
publicboolRandomizeLinesQuadsAngle{…}
indicates whether to randomize the angles of quads while drawing lines. It can be used to simulate spray tool behavior with an appropriate brush texture.
Tools parameters can be displayed in the Inspector tab if they have the [PaintToolSettings] attribute.
Color Picker Classes
ColorPickerManager
The ColorPickerManager component provides a comprehensive color selection interface with multiple layouts, palette integrations, and color space representations.
palette asset source for Palette mode (texture generated on demand).
Average Color Calculator
AverageColorCalculator
The AverageColorCalculator component calculates the average color of a texture. It samples the texture based on set accuracy and can exclude transparent pixels if needed.
Properties & Fields
Member
Description
publicPaintManagerPaintManager
the PaintManager used to get the average color;
publicPaintRenderTexturePaintRenderTexture
the texture on which the average color is calculated;
publicboolSkipTransparentPixels
flag indicating whether to skip transparent pixels in the source texture during color sampling;
Events
Event
Description
publiceventAction<Color>OnGetAverageColor
event triggered when the average color is calculated during painting;
Methods
Method
Description
publicvoidSetAccuracy(intaccuracy)
sets the sampling accuracy for color calculation.
The AverageColorCalculator uses the shader XD Paint/Average Color to sample the texture and determine the average color. Two parameters control this process: the main texture and accuracy (which acts as a divider for the number of samples taken). Higher accuracy values increase the number of samples and GPU usage, while lower values improve performance but reduce accuracy.
ColliderPainter
ColliderPainter
The ColliderPainter component allows painting on PaintObject surfaces using collision data. It captures raycast positions during OnCollisionEnter and OnCollisionStay events and uses the brush to paint on the object based on the collision data.
event triggered when a collision occurs, allowing painting based on the collision data. The first argument is the PaintManager, and the second is the collision data;
Properties
Property
Description
publicpublicColorColor
color to use for painting during a collision;
publicpublicfloatPressure
value to scale the brush size during painting, simulating pressure sensitivity.