UI Elements with Content Size Fitter

Hi all, I have a little problem
2266439--151768--gsgdg.png
As you can see I have to UI elements above each other, one for money and Level and one as an EXP Bar
The problem is the top one uses a content size refitter, so the distance between them changes, and as it resizes it, it doesn’t appear that the rect max values change
Does anybody know any way, be it scripted or editor, so that the distance between them is constant AKA move the EXP bar so it is always that relative distance from the new bottom of the top UI element? Almost as if it was a parent child relationship

Easy.

http://docs.unity3d.com/Manual/script-VerticalLayoutGroup.html

What you need is spacing value, put whatever you like. If you dont know how to use it just google, there are a tons of videos…

Ah, thank you :slight_smile:
So would I need a parent UI object with this component attached, of which the 2 UI elements I have are children?

Yes, of course.

Errm
Looks good in 16:9 at that resolution


Then…I have no idea what happened :frowning:

Becaue you did not configured the scale factor when the resolutions changes. That’s why.

I highly recommend you to watch the following tutorial:

http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/resolution-and-device-independence

This will give you a lot of knowledge about UI.

About ur actual issue, you have to add Layout Element to each of ur UI objects: Redirecting to latest version of com.unity.ugui

and add the prefered min width and height values and etc… just google for more information and watch that live training.

Hi, sorry for replying, on holiday and only got WiFi now :slight_smile:

Many thanks, I’ll make sure to do that when I have a chance;)