# Terrain brush not where cursor is.

**URL:** https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290
**Category:** Terrain
**Created:** [April 1, 2013, 8:57pm UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290 "2013-04-01T20:57:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Blizzagen2](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@Blizzagen2](https://discussions.unity.com/u/Blizzagen2)
#### Post date: [April 1, 2013, 8:57pm UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/1 "2013-04-01T20:57:30Z")

</div>

Hi,  
The terrain paintbrush/raise/lower brush is not synced up, for lack of a better term, with where my cursor is. My cursor can be clicking away in the middle of the screen with nothing happening, and then I zoom out and notice the corner of the terrain is risen/lowered/textured etc. The effect is lessened with larger terrains but there is still a fair distance between the cursor + brush.

I have reinstalled Unity to no effect.

Here are two other threads from March and May 2012 with people experiencing the same problem.  
[http://forum.unity3d.com/threads/126274-Terrain-Brush-Not-Lining-up-with-Cursor](http://forum.unity3d.com/threads/126274-Terrain-Brush-Not-Lining-up-with-Cursor)  
[http://answers.unity3d.com/questions/240059/when-editing-terrain-brush-does-not-fall-on-cursor.html](http://answers.unity3d.com/questions/240059/when-editing-terrain-brush-does-not-fall-on-cursor.html)  
This is really frustrating. I’d really appreciate any advice.

Thanks,

---

<div class="post-metadata">

### Author: ![TheEShearer](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@TheEShearer](https://discussions.unity.com/u/TheEShearer)
#### Post date: [May 27, 2015, 3:14am UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/2 "2015-05-27T03:14:00Z")

</div>

After struggling with this for a day or two, i was finally able to get it to work again by simply unchecking the terrain collider in the inspector and then turning it back on again.

---

<div class="post-metadata">

### Author: ![armaan8014](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/armaan8014/32/915409_2.png) [@armaan8014](https://discussions.unity.com/u/armaan8014)
#### Post date: [February 18, 2020, 1:35pm UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/3 "2020-02-18T13:35:21Z")

</div>

> [@TheEShearer](#):
>
> After struggling with this for a day or two, i was finally able to get it to work again by simply unchecking the terrain collider in the inspector and then turning it back on again.

5 years later - thank you!!

---

<div class="post-metadata">

### Author: ![konpet](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@konpet](https://discussions.unity.com/u/konpet)
#### Post date: [December 19, 2021, 7:30pm UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/4 "2021-12-19T19:30:25Z")

</div>

Thank you for this! For me it did not work out just by unchecking, I am not sure how I did it, but it eventually worked, after I did it 10 times and reset the Terrain Collider block, and unchecked again. Really annoying problem to say the least…

---

<div class="post-metadata">

### Author: ![donkey0t](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@donkey0t](https://discussions.unity.com/u/donkey0t)
#### Post date: [April 30, 2023, 7:45am UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/5 "2023-04-30T07:45:55Z")

</div>

I had a similar problem after changing the resolution settings with the newer Unity Terrain tools. Restarting Unity seemed to solve it

---

<div class="post-metadata">

### Author: ![Nonearthanti](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@Nonearthanti](https://discussions.unity.com/u/Nonearthanti)
#### Post date: [April 19, 2026, 12:36pm UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/6 "2026-04-19T12:36:15Z")

</div>

11 years later and turning the collider off and on again still worked. Thank you.

---

<div class="post-metadata">

### Author: ![kegfutsaw334](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@kegfutsaw334](https://discussions.unity.com/u/kegfutsaw334)
#### Post date: [June 16, 2026, 7:14am UTC](https://discussions.unity.com/t/terrain-brush-not-where-cursor-is/501290/7 "2026-06-16T07:14:02Z")

</div>

Since this is still an issue after all these years I’ll share my automatic fix that doesn’t require saving or toggling the terrain collider. Create a file called TerrainUndoResync.cs in Assets\Editor\ and paste in the following code (must be placed in each individual project):

```auto
// TerrainUndoResync.cs
//
// Fixes the terrain brush desync after undo WITHOUT saving the scene or toggling the terrain collider.
//
// Why simply invoking SyncHeightmap() does nothing:
// Terrain sculpting happens on the GPU heightmap. Undo reverts that GPU
// heightmap (so the terrain LOOKS correct) but does NOT mark any region
// dirty. SyncHeightmap() only propagates regions that are flagged dirty, so
// with nothing flagged it was a no-op -- the CPU heightmap and the collider
// (which the brush raycasts against) kept the stale, pre-undo heights.
//
// The fix: mark the ENTIRE heightmap dirty, then sync. That forces the reverted
// GPU heights down onto the CPU data + collider, realigning the brush with what
// you see.
//
// Runs automatically on undo/redo.

using UnityEditor;
using UnityEngine;

[InitializeOnLoad]
public static class TerrainUndoResync
{
    static TerrainUndoResync()
    {
        Undo.undoRedoPerformed -= OnUndoRedo;
        Undo.undoRedoPerformed += OnUndoRedo;
    }

    // Defer one tick so the terrain has finished reverting before we resync.
    static void OnUndoRedo() => EditorApplication.delayCall += Resync;

    [MenuItem("Tools/Resync Terrain (Dirty + Sync) %&r")]
    static void Resync()
    {
        var terrains = Object.FindObjectsByType<Terrain>(FindObjectsSortMode.None);
        int n = 0;

        foreach (var terrain in terrains)
        {
            var data = terrain != null ? terrain.terrainData : null;
            if (data == null) continue;

            int res = data.heightmapResolution;

            // Mark the whole heightmap dirty so SyncHeightmap has something to
            // propagate (this is the step undo skips), then push it through to
            // the CPU heights, the LOD mesh, and the collider.
            data.DirtyHeightmapRegion(
                new RectInt(0, 0, res, res),
                TerrainHeightmapSyncControl.HeightAndLod);
            data.SyncHeightmap();

            n++;
        }
    }
}

```

Tested and confirmed working. Fix generated with Claude Opus 4.8
