title: Get Size of 3d mesh inside a Prefab in Unity?
body: <p><br/>I want to create a hexagon grid. I Have a 3D model which I made in blender with some dimensions.<br/>
  I have a script in Unity which is supposed to generate a hex grid with a given hexagon.<br/>
  The model of the hex is placed in a Prefab. I need the size "Real size not the scale" of that prefab in order to generate the grid. <br/>
  How can I get the size of the model which is in a prefab.</p>
  
  <pre><code>public class GameWorld : MonoBehaviour
  {
      // Fields
      public GameObject HexPrefab;
  
      // Size of the map in terms of number of the objects
      // This is not representative of the actual size of the map in units
      public int Width = 20;
      public int Height = 20;
  
      void Start()
      {
          MeshRenderer[] asd = HexPrefab.GetComponentsInChildren&lt;MeshRenderer&gt;();
          var a = asd[0].bounds;
  
          Debug.Log(string.Format("x: - {0:f3}", a.size.x));
          Debug.Log(string.Format("y: - {0:f3}", a.size.y));
          Debug.Log(string.Format("z: - {0:f3}", a.size.z));
  
          for (int x = 0; x &lt; Width; x++)
          {
              for (int y = 0; y &lt; Height; y++)
              {
                  Instantiate(HexPrefab, new Vector3(x, 0, y), Quaternion.identity);
              }
          }
      }
  
      void Update()
      {
  
      }
  }
  </code></pre>
  
  <p>Here are the dimensions from blender.<br/>
  <a href="https://i.stack.imgur.com/0k1h1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0k1h1.png" alt="enter image description here"></a><br/>
  I don't want to hard code it because I will need to use hexagons of different sizes in the future!<br/>
  This code gives me a size of 0.
  The prefab consists of only one model and nothing else.
  Thank you in advance!</p>