How to set UGUI Rect Transform stretch Left/Right/Top/Bottom to percentage mode?

Viewed 33

In an UGUI prefab, I need to set a son object away from its father's object border.

When the prefab used in somewhere and stretched to 256x256, the gap of border will be 20 pixels. In the son's Rect inspector, I set Left 20. But in somewhere the prefab will be 64x64, the gap is 4 pixels now. The Rect Left is still 20 in inspector, I need it becomes to 4 automatically.

So I think I need to set the son object is away form father border 5% of father's width.

Do the 'Left/Right/Top/Bottom' provide percentage mode? Or how to make an UGUI prefab to make its children object which set to stretch mode keep the proportion?

0 Answers
Related