Positioning UI elements with Anchor Presets via code
问题 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. We select top, middle, bottom, stretch and the blue color dot. How can I do the same thing if I create UI element in the code in C#? I make Texture2D textureWhite = new Texture2D(1, 1); textureWhite.SetPixel(0, 0, Color.white); textureWhite.Apply(); How can I fix as top left corner together with blue color dot? 回答1: The anchors(min,max) values and the pivot