title: How to instantiate GameObject from prefab using Resources.Load?
body: <p>I get a <strong>NullReferenceException</strong> error when I try to instantiate a GameObject the following way:</p>
  
  <pre><code>Side1_Slots.sGameObject[i] = Instantiate(Resources.Load&lt;GameObject&gt;(Side1_Slots.SlotAlliedPrefab), 
              Side1_Slots.SlotPosition[i], Quaternion.identity, UIContainer.transform);
  </code></pre>
  
  <p>Using this overloaded method for Instantiate:</p>
  
  <pre><code>Instantiate(GameObject Original, Vector3 position, Quaternion rotation, Transform parent);
  </code></pre>
  
  <p>Where:</p>
  
  <pre><code>Side1_Slots.SlotAlliedPrefab = "Prefabs/Battle/SlotAlliedPrefab";
  </code></pre>
  
  <p>I've tried the following project folder structures:</p>
  
  <pre><code>// Leads to NullReferenceException error
  Resources/Prefabs/Battle/SlotAlliedPrefab
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>//Leads to "Object you want to instantiate is null"
  Prefabs/Battle/SlotAlliedPrefab
  </code></pre>
  
  <p>Which one is correct by the way? Google shows both ways, so I'm not sure...</p>