title: unity freezes when my loop activates, and displays no error message
body: <p>ok, so i am making a script for my game that generates the composition of a silicate planet. it is not great code, as i am pretty new to coding, but here it is:</p>
  <pre><code>using UnityEngine;
  
  public class silicateComposition : MonoBehaviour
  {
  
      public GameObject noise;
  
      public int silicone;
      public int ironOxide;
      public int iron;
      public int oxygen;
      public int aluminium;
      public int calcium;
      public int sodium;
      public int potassium;
      public int magnesium;
  
      // Start is called before the first frame update
      void Start()
      {
          Debug.Log(&quot;was run&quot;);
          int seed = noise.GetComponent&lt;mapGenerator&gt;().seed;
  
          
          
              Debug.Log(&quot;go2&quot;);
              ironOxide = seed / 15;
              iron = seed / 100;
              oxygen = seed / 13;
              aluminium = seed / 132;
              calcium = seed / 104;
              sodium = seed / 115;
              potassium = seed / 193;
              magnesium = seed / 294;
              int total = iron + ironOxide + oxygen + aluminium + calcium + sodium + potassium + magnesium;
  
              Debug.Log(ironOxide);
              Debug.Log(iron);
              Debug.Log(oxygen);
              Debug.Log(aluminium);
              Debug.Log(calcium);
              Debug.Log(sodium);
              Debug.Log(potassium);
              Debug.Log(magnesium);
              Debug.Log(total);
          
              if (total &gt; 85)
              {
                  int t = total - 85;
                  total = total - t;
                  int iod = ironOxide.ToString().Length;
                  int id = iron.ToString().Length;
                  int od = oxygen.ToString().Length;
                  int ad = aluminium.ToString().Length;
                  int sd = sodium.ToString().Length;
                  int pd = potassium.ToString().Length;
                  int md = magnesium.ToString().Length;
                  int cd = calcium.ToString().Length;
  
                  Debug.Log(iod);
  
                  if (iod &gt;= 2)
                  {
                      int iod2 = iod;
                      int temp = 0;
                      while (iod &gt; 2)
                      {
                          iod = iod - 1;
                          temp = temp + 1;
  
                      }
                      iod = temp;
                      int tens = 1000000;
                      temp = 0;
                      
                      while (tens.ToString().Length &gt; iod)
                      {
                          tens = tens / 10;
                      }
                      if (tens = 1)
                      {
                          tens = 10;
                      }
                      ironOxide = ironOxide / tens;
                      
                  }
                  
  
                  silicone = 100 - total;
                  if (silicone &lt; 0)
                  {
                      silicone = 0;
                  }
  
              }
  
  
  
  
  
  
          }
  
     
  
      
  }
  </code></pre>
  <p>so basically it generates a random percentage based on real life proportions and a seed. Also i have only coded the iron Oxide loop, so I can figure out how to do it before i do it with every element.</p>
  <p>It does work, until it hits the <em>if total is above 85</em> if statement. then unity just freezes. I do not understand why, as I have poured over the code for 2 days now and I'm losing my sanity. thank you for any help.</p>