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.
Comments (8)
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
- Vertical Layout Group doesn't maintain proper spacing when nested UI elements change size at runtime
- Error "Objects are trying to be loaded during a domain backup. This is not allowed as it will lead to undefined behaviour!" when entering Play Mode with the PBR Sky Shader Graph created in Project
- Custom Property and Function Labels at the top of the Graph Inspector go out of bounds and are not truncated when String is long
- Warning "Full dialog message:" is logged when the project is upgraded to a newer version
- A 404 page is opened when selecting "Open Documentation" for any of the HDRP specific Input Nodes in Shader Graph
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