I’m new to unity. trying to use New 4.6 UI system.
but I wonder how to set minimum size or maximum size of my panels or images while using the anchors system.
I’m really satisfied with anchor system, it’s so easy, but no such things support??
I’m not sure I undertand correctly, but if you mean a min/ max size in pixels, that would need to be done through script. You can then easily convert your numbers in pixels to relative anchor points by dividing that number by the screen width. For example:
int maxWidth = 400;
float relWidth = maxWidth / Camera.main.pixelWidth;
rectTransform.achorMax = new Vector2(rectTransform.anchorMin.x + relWidth, rectTransform.anchorMax.y);
1 Like