Search Issue Tracker
Fixed in 2022.1.0b4
Votes
1
Found in
2022.1
2022.1.0b4
Issue ID
1396818
Regression
No
DivideByZeroException in UniityEditor.TerrainInspector.GetAspectRect after selecting Terrain with enabled Paint texture panel
Steps to repro:
1. Pull the repository linked in the comments and switch to revision 8b2d1b1dd2b0cbbf2fd11c4bf008bfae4607aef2;
2. Open the project and scene "SK_TestScene";
3. In the Hierarchy select TerrainBase gameobject;
4. In the Inspector select Paint Texture tab;
5. In the Hierarchy select TerrainPark gameobject.
Actual result:
Error:
DivideByZeroException: Attempted to divide by zero.
UnityEditor.TerrainInspector.GetAspectRect (System.Int32 elementCount, System.Int32 approxSize, System.Int32 extraLineHeight, System.Int32& itemsPerRow) (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.TerrainInspector.AspectSelectionGridImageAndText (System.Int32 selected, System.Int32 itemCount, UnityEngine.GUI+CustomSelectionGridItemGUI itemGUI, System.Int32 approxSize, UnityEngine.GUIContent emptyString, System.Boolean& doubleClick) (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.TerrainInspector.AspectSelectionGridImageAndText (System.Int32 selected, UnityEngine.GUIContent[] textures, System.Int32 approxSize, UnityEngine.GUIContent emptyString, System.Boolean& doubleClick) (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.TerrainLayerUtility.ShowTerrainLayersSelectionHelper (UnityEngine.Terrain terrain, System.Int32 activeTerrainLayer) (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.TerrainTools.PaintTextureTool.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.TerrainTools.IOnInspectorGUI editContext) (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.TerrainInspector.ShowPaint () (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.TerrainInspector.OnInspectorGUI () (at <5d684a862a4a439185f337d8fab2f3d2>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass62_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a41af8713c314ad8b19c9e0c8298b3b8>:0)
UnityEditor.InspectorWindow:RedrawFromNative()
is shown. See attached video.
Expected result:
No error is shown after selecting Terrain gameobject.
Notes:
- Reproducible in Version 2022.1.0b4;
- Reproducible on Windows;
- Also reproducible with Paint Trees tab selected in the Terrain Inspector.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
mcbauer
Jan 23, 2023 13:15
I can also verify that the issue stops once I remove my grass details.
MadKadir
Nov 28, 2022 05:15
It might be a bug related with the Unity GUI panel itself... the Inspector window width... resize the terrain inspector window by dragging the border.
Jaggard
Nov 23, 2022 23:22
I have the exact same problem in unity 2021.3.14f1 without any extra packages. I have not even clicked on the grass tab yet.
Yany
Nov 19, 2022 17:24
2022.1.22f1 still has this issue. The very same exception:
DivideByZeroException: Attempted to divide by zero.
UnityEditor.TerrainInspector.GetAspectRect (System.Int32 elementCount, System.Int32 approxSize, System.Int32 extraLineHeight, System.Int32& itemsPerRow) (at <70229d9c56924d7794599e8f1526153f>:0)
UnityEditor.TerrainInspector.AspectSelectionGridImageAndText (System.Int32 selected, System.Int32 itemCount, UnityEngine.GUI+CustomSelectionGridItemGUI itemGUI, System.Int32 approxSize, UnityEngine.GUIContent emptyString, System.Boolean& doubleClick) (at <70229d9c56924d7794599e8f1526153f>:0)
UnityEditor.TerrainInspector.AspectSelectionGridImageAndText (System.Int32 selected, UnityEngine.GUIContent[] textures, System.Int32 approxSize, UnityEngine.GUIContent emptyString, System.Boolean& doubleClick) (at <70229d9c56924d7794599e8f1526153f>:0)
UnityEditor.TerrainInspector.ShowTrees () (at <70229d9c56924d7794599e8f1526153f>:0)
UnityEditor.TerrainInspector.OnInspectorGUI () (at <70229d9c56924d7794599e8f1526153f>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass62_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <eae4e950171640a6a436587c4978a87e>:0)
UnityEditor.InspectorWindow:RedrawFromNative()
lorddanger
Jul 12, 2022 02:54
Same issue in 2021.3.5f1
Ryan-Hayle
Mar 11, 2022 10:42
Will this issue be backported?
Ryan-Hayle
Mar 11, 2022 10:40
I have the same issue (or very similar) in Unity 2021.2.8 HDRP and I do not use terrain details.
DivideByZeroException: Attempted to divide by zero.
UnityEditor.TerrainInspector.GetAspectRect (System.Int32 elementCount, System.Int32 approxSize, System.Int32 extraLineHeight, System.Int32& itemsPerRow) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.TerrainInspector.AspectSelectionGridImageAndText (System.Int32 selected, System.Int32 itemCount, UnityEngine.GUI+CustomSelectionGridItemGUI itemGUI, System.Int32 approxSize, UnityEngine.GUIContent emptyString, System.Boolean& doubleClick) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.TerrainInspector.AspectSelectionGridImageAndText (System.Int32 selected, UnityEngine.GUIContent[] textures, System.Int32 approxSize, UnityEngine.GUIContent emptyString, System.Boolean& doubleClick) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.TerrainLayerUtility.ShowTerrainLayersSelectionHelper (UnityEngine.Terrain terrain, System.Int32 activeTerrainLayer) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.TerrainTools.PaintTextureTool.OnInspectorGUI (UnityEngine.Terrain terrain, UnityEditor.TerrainTools.IOnInspectorGUI editContext) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.TerrainInspector.ShowPaint () (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.TerrainInspector.OnInspectorGUI () (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <6e80f6af65b64894a5fb8578a935bf61>:0)
UnityEditor.UIElements.Tooltip:SetTooltip(Single, Single)
Fernando-Ferreira
Mar 04, 2022 16:13
after debuging for a while, I noticed maybe the grass system is causing it