title: Unity 4.6: Button instances added at runtime are not scaled by Reference Resolution?
body: <p>(Using Unity 4.6.0b20)</p>
  
  <p>I've hit a problem where prefab button size works correctly when added in editor but seems to ignore Reference Resolution when added by script.</p>
  
  <p>This uses a Canvas with Reference Resolution 1280x720 and MatchWidthOrHeight. Canvas has a Panel Vertical Layout Group for the buttons. The Button has Preferred Width/Height, and it is saved as a Prefab so new instances can be created from assets at runtime.</p>
  
  <p><img src="https://i.stack.imgur.com/TaZnH.png" alt="enter image description here"></p>
  
  <p>In the editor I can drag the prefab to scene to add instances to the panel which also has width 102 and they stack and scale nicely:</p>
  
  <p><img src="https://i.stack.imgur.com/nQ6OD.png" alt="enter image description here"></p>
  
  <p>But when instead I add new instances of the prefab via script to the Panel they appear with the wrong size. Looking at the dimensions my guess is the 102 pixel size is not being scaled by the Reference Resolution:</p>
  
  <p><img src="https://i.stack.imgur.com/uR70j.png" alt="enter image description here"></p>
  
  <p>The script code creates the instance via GameObject.Instantiate() and adds to the Panel by setting transform.parent:</p>
  
  <pre><code>GameObject uiInstance = (GameObject)GameObject.Instantiate(Resources.Load&lt;GameObject&gt;(assetPath));
  uiInstance.transform.parent = unitButtonsPanel.transform;
  </code></pre>
  
  <p>I assume either there is more that needs to be done when adding the Button to the Panel than just setting Parent, or it's a bug with the beta...</p>
  
  <p>Suggestions?</p>