Search Issue Tracker

Won't Fix



Found in


Issue ID




Crash on TerrainData_CUSTOM_Internal_SetDetailLayer when executing TerrainData.SetDetailLayer()



Reproduction steps:
1. Open the attached project “TerrainCrash”
2. Enter Play Mode

Expected result: Terrain is created at runtime
Actual result: Editor crashes

Reproducible with: 2020.3.45f1, 2021.3.20f1, 2022.1.24f1
Not reproducible with: 2022.2.0a1, 2022.2.9f1, 2023.1.0b5, 2023.2.0a4
Reproducible on: Windows 10, macOS 13.1

On macOS 13.1 it freezes instead of crash.
With the 2020.3.45f1 version in “TestTerrainDetail.cs” replace line 20 with: new DetailPrototype()

{noformat}0x00007ff7323ab18b (Unity) TerrainData_CUSTOM_Internal_SetDetailLayer
0x00000211f89fe764 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.TerrainData:Internal_SetDetailLayer (UnityEngine.TerrainData,int,int,int,int,int,int[,])
0x00000211f89fe65b (Mono JIT Code) UnityEngine.TerrainData:SetDetailLayer (int,int,int,int[,])
0x00000211f89fccb3 (Mono JIT Code) [TestTerrainDetail.cs:44] TestTerrainDetail:Start ()
0x00000212c2dd8ce8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr){noformat}

  1. Resolution Note:

    The project attached in there lists its a 2021 project, but the TerrainData seems to be serialized with a later version thus the there is no DetailPatch::numberOfObjects arrays (causing data inconsistency and crash like described in the report) - instead it serializes fine with the recent trunk with data popped into DetailPatch::coverage.

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.