public class RectCtrl : MonoBehaviour
{
private void Start()
{
var imgRect = GetComponent<RectTransform>();
/*imgRect.localScale = Vector3.one * 2;
imgRect.localRotation = Quaternion.Euler(Vector3.forward*45f);
imgRect.pivot = new Vector2(0, 0);
imgRect.anchorMin = new Vector2(0.1f, 0.1f);
imgRect.anchorMax = new Vector2();
imgRect.anchoredPosition3D = new Vector3(-100, -50, 0);
imgRect.sizeDelta = new Vector2(50, 50);*/
imgRect.anchorMin = new Vector2(1, 0.5f);
imgRect.anchorMax = new Vector2(1, 0.5f);
}
}
- offsetMin : 对应Left、Bottom
- offsetMax : 对应Right、Top