title: How to set a prefab-cloned object position to (0,0,0) relative to parent?
body: <p>I have a UI panel.
  In that panel, I want to add many times the same prefab (a small circle).
  My code looks like this:</p>
  
  <pre class="lang-c# prettyprint-override"><code>GameObject o = GameObject.Find("PanelCells");
  Rect r = o.GetComponent&lt;RectTransform&gt;().rect;
  RemoveAllChildren(o.transform);
  for (float i = 0; i &lt; 10; i += (float)1.0) {
      GameObject c = Instantiate(
          prefabCell, Vector3.zero, Quaternion.identity, o.transform
      );
      c.transform.localScale = new Vector3(1, 1, 1);
      Debug.Log("Before : " + c.transform.localPosition.ToString());
      c.transform.localPosition = new Vector3(i * 10, 0, 0);
      Debug.Log("After : " + c.transform.localPosition.ToString());
  }
  </code></pre>
  
  <p>In the debug log I can see (for the #1 iteration log): </p>
  
  <pre><code>Before : (-288.1, 0.0, 1559.4)
  After : (0.0, 0.0, 0.0)
  </code></pre>
  
  <p>And when I go into the game, here are the position of the first prefabs: 288.11, 298.11, 308.11 and so on. So the <code>i * 10</code> worked...</p>
  
  <p>If I set x to <code>0</code> manually from the editor when the game is running, it goes where I want it to go = to the <code>0</code> position.</p>
  
  <p>I just want my dynamically generated prefabs to go to <code>(i * 10, 0, 0)</code> position, not what it is right now (<code>( (288.11 + i) * 10, 0, 0)</code>)</p>
  
  <p>I want all of them to go to the x position <code>0</code> to <code>10</code>, <code>20</code>, <code>30</code> and so on.</p>
  
  <p>What I mean by position (0,0,0) is "top left" relative to the parent.</p>
  
  <p>Here's the screenshot of the parent configuration:</p>
  
  <p><a href="https://i.stack.imgur.com/Zlmhv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zlmhv.jpg" alt="screenshot of the parent configuration"></a></p>
  
  <p>Here's my prefab:</p>
  
  <p><a href="https://i.stack.imgur.com/EnaHw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EnaHw.jpg" alt="screenshot of my prefab"></a></p>
  
  <p>And here's where I'd like the first element to be positioned when I set manually (0,0,0) to its position:</p>
  
  <p><a href="https://i.stack.imgur.com/wPEsw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wPEsw.jpg" alt="screeshot of what I want"></a></p>
  
  <p>What am I missing?</p>