title: Setting position of child transform, relative to parent in Unity
body: <p>I have set the parent of a HUD camera's transform to the transform of the object it's 'orbiting'. The trouble is, when I then set the position of the child transform, it is still being moved to 'global' coordinates.  </p>
  
  <p>I have tested this in the Unity editor, paused the game, and the HUD camera is, indeed, a child of the parent object (it is listed under that object's hierarchy).  </p>
  
  <p>The Unity tutorial here...<br>
  <a href="https://unity3d.com/learn/tutorials/topics/interface-essentials/hierarchy-and-parent-child-relationships" rel="nofollow">https://unity3d.com/learn/tutorials/topics/interface-essentials/hierarchy-and-parent-child-relationships</a><br>
  ...seems pretty clear that, once an object is made a child of another, its position is relative to the parent object (from about 45 seconds into the video). But is there a difference between doing this programmatically and manually in the Unity editor?</p>
  
  <p>Here's my relevant code:</p>
  
  <pre><code> hudCamera.transform.parent = hudSelectedObject.transform;
   hudCamera.transform.position = new Vector3(0, 0, -50); // this still moves the HUD camera to global position 0, 0, -50 - why?
  </code></pre>
  
  <p>The parent object is not positioned at 0, 0, 0, so it's not just that the child object position is set relative to 0, 0, 0.</p>
  
  <p>So how do I programmatically set the position of the HUD camera so it is relative to the parent transform position, if not by just setting it as a child of the parent object and then setting its position?
   Thanks. </p>