Search Issue Tracker

Won't Fix

Votes

0

Found in

5.3.1f1

Issue ID

788317

Regression

No

Undo.RecordObject is very slow for terrains

Terrain

-

Edit before closing: Undo.RecordObject will perform a binary exact comparison between states of the object you are monitoring to find and record what changes are made to the object. In the case of TerrainData, which contains large arrays (e.g. the height map), this approach is rather inefficient. We suggest you use Undo.RegisterCompleteObjectUndo instead, which will only create a 'snapshot' of the TerrainData, and won't do the comparison. It's much faster.

Steps to reproduce:

1. Open attached project "788317.zip"
2. Open scene "repro"
3. In top menu, select "Window > Reset Terrain"
4. Notice that height of terrain is reset but Unity becomes unresponsive
5. Unity hangs for several minutes

Workaround: Use now obsolete Undo.RegisterUndo

Reproduced with: 5.1.4f1, 5.2.4f1, 5.3.4p3, 5.4.0b15

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.