title: Positioning UI elements with Anchor Presets via code
body: <p>When we position UI elements in Unity, we fix the position from Anchor Presets, so that it's position is placed correctly on the canvas.</p>
  
  <p><a href="https://i.stack.imgur.com/8yzLX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8yzLX.png" alt="enter image description here"></a></p>
  
  <p>We select top, middle, bottom, stretch and the blue color dot.</p>
  
  <p>How can I do the same thing if I create UI element in the code in C#?</p>
  
  <p>I make </p>
  
  <pre><code>Texture2D textureWhite = new Texture2D(1, 1);
  textureWhite.SetPixel(0, 0, Color.white);
  textureWhite.Apply(); 
  </code></pre>
  
  <p>How can I fix as top left corner together with blue color dot?</p>