# OnPaint(Terrain, IOnPaint)

> Custom terrain tool paint callback.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.TerrainTools](/engine/6000.5/script-reference/unityeditor/terraintools.md)
* **Assembly:** UnityEditor

```csharp
public virtual bool OnPaint(Terrain terrain, IOnPaint editContext)
```

### Parameters

**** (\[Terrain]\(/engine/6000.5/script-reference/unityengine/terrain)): Active Terrain object.**** (\[IOnPaint]\(/engine/6000.5/script-reference/unityeditor/terraintools/ionpaint)): Interface used to communicate between Editor and Paint tools.

### Returns

| Type                                                          | Description                                                                    |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Return true to temporarily hide tree, grass, and detail layers on the terrain. |

### Remarks

Unity calls this method when the mouse button is pressed or dragged, which is typically when a tool applies its modifications. Some tools may instead want to apply their modifications in custom painting logic from within [TerrainPaintTool\<T>.OnSceneGUI](/engine/6000.5/script-reference/unityeditor/terraintools/terrainpainttool1/onscenegui.md). When the method returns true, the layers on top of the terrain, such as trees, grass, and other details, are not rendered.

Additional Resources: [PaintContext](/engine/6000.5/script-reference/unityengine/terraintools/paintcontext.md)
