Topic: DevideByZeroException: Division by zero

Help me....I cannot sovled this problem

<error message>

DivideByZeroException: Division by zero
MeshToTerrainPrefs.OnTerrainsGUINew () (at Assets/Infinity Code/MeshToTerrain/Scripts/Editor/MeshToTerrainPrefs.cs:500)
MeshToTerrainPrefs.OnTerrainsGUI () (at Assets/Infinity Code/MeshToTerrain/Scripts/Editor/MeshToTerrainPrefs.cs:351)
MeshToTerrainPrefs.OnGUI () (at Assets/Infinity Code/MeshToTerrain/Scripts/Editor/MeshToTerrainPrefs.cs:280)
MeshToTerrain.OnGUI () (at Assets/Infinity Code/MeshToTerrain/Scripts/Editor/MeshToTerrain.cs:624)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

Post's attachments

Attachment icon dividebyzeroexception.PNG 371.32 kb, 70 downloads since 2016-06-14 

Re: DevideByZeroException: Division by zero


It happened when resolutionPerPatch = 0.

How to fix it:
Add this to «MeshToTerrainPrefs.cs» Line 499:
if (resolutionPerPatch <1) resolutionPerPatch = 1;

Actually a fixed version is available for a long time through the built-in update system.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 40 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.