Position a UI control relative to another


I’m trying to achieve something like Relative layout does on android. I want to position a UI element based on another UI element. For example, to the right of this element or at the top, etc…

I could do this programatically but want to know if it is possible to accomplish this task using uGUI own capabilities.


May not be exactly what you are asking but you can do a lot with Layout Groups. Create an empty panel and attach Horizontal, Vertical, or Grid Layout Group script to it. Then add child elements to the panel and attach Layout Element script to each of them. Look at the layout group & layout element’s properties - you can configure them in many different ways. That, combined with Anchoring (which you can access through RectTransform properties), allows to create a powerful dynamic UI layout system.