- Home /
Die Frage ist beantwortet, die korrekte Antwort wurde akzeptiert.
How to use multiple anchor presets?
I am currently creating a mobile friendly GUI and I have problems with my scrollbar. So I am trying to make the scrollbar responsive, so it scales with the size of the screen and I also would like to make it stick to the right side of the screen. Actually pretty much like every scrollbar.
For scaling I used the vertical stretching anchor preset - works fine, but if I scale the screen horizontally the scrollbar does not stick to the right side of the screen.
If I use the anchor preset for setting the position on the right, the scrollbar sticks to the right side as I want it to do, but if I scale the screen vertically the scrollbar does not stretch anymore.
I have already tried to make a panel with one anchor preset, the scrollbar with another and making the panel to a parent of the scrollbar, but this didn't work for me either. Is there a way to use two anchor presets at the same time for one single RectTransform? What am I doing wrong?
I think there is a pretty obvious and simple solution, so thanks in advance for helping.
Answer by DiegoSLTS · Aug 12, 2016 at 05:20 PM
I got a little lost with your description, can you draw some images to explain your issue better?
As for the last question, you can't use 2 anchor presets, but they're just presets for the actual anchor and pivot values below, so you can set a custom anchor if one of those doesn't work. Also note that there's a preset for horizontal right and vertical strech, which sounds like what you want to do, but without more details on your current setup I can't give you a proper answer.
Answer by sebastianfeistl · Aug 13, 2016 at 07:21 PM
Well, I'm sorry for the confusing description, but I already solved the problem. I actually used the wrong template options ..
I hope this helps to understand:
So, as you can see the scrollbar used to disappear if the screen was very wide, but I probably have overlooked the option to also set the position of the element when pressing the ALT-Key.
Nevertheless, thank you very much for your reply!