title: GameObject.name vs new GameObject(name)
body: <p>Is there a difference <em>performance-wise</em> between using </p>
  
  <p><strong>Example 1</strong></p>
  
  <pre><code>var myObject = new GameObject();
  myObject.name = "myObjectName";
  </code></pre>
  
  <p>And</p>
  
  <p><strong>Example 2</strong> </p>
  
  <pre><code>var myObject = new GameObject("myObjectName");
  </code></pre>
  
  <p>Some articles like <a href="https://divillysausages.com/2016/01/21/performance-tips-for-unity-2d-mobile/" rel="nofollow noreferrer">this</a> suggest avoiding <strong>Example 1</strong> because native code is called, hurting performance. </p>
  
  <p>Out of curiosity, I checked <a href="https://docs.unity3d.com/ScriptReference/GameObject-ctor.html" rel="nofollow noreferrer">the documentation</a> of the <code>GameObject</code> class and there are no remarks indicating how any of the constructors might affect performance.</p>
  
  <p>My current theory is that <strong>Example 2</strong> is similar to <a href="https://docs.unity3d.com/ScriptReference/Object.Instantiate.html" rel="nofollow noreferrer">instantiating an object and immediately specifying a parent</a> as that is supposedly better than instantiating an object and specifying the parent later.</p>