Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Tatanan on July 14, 2014, 05:13:32 AM

Title: Scroll View doubts
Post by: Tatanan on July 14, 2014, 05:13:32 AM
After having read carefully the video tutorials of this component, I can make several things, but still have 2 doubts. I'll try to be as detailed as possible.
Thank you.
Title: Re: Scroll View doubts
Post by: ArenMook on July 15, 2014, 12:24:38 AM
1. You can't scroll things that are anchored for obvious reasons. If you want buttons to be aligned on one axis (for example horizontally) and scrolled on the other axis (for example vertically), then use advanced anchoring and set left and right, but don't set top and bottom anchors.

2. It wouldn't be UICenterOnChild anymore then. Note that the scroll view is centered on game objects underneath the UICenterOnChild script. You don't have to use a center pivot on those objects. If you have this:

UIScrollView
- UICenterOnChild
-- Item 1
-- Item 2
-- Item 3

Then you can change it to be:

UIScrollView
- UICenterOnChild
-- Offset 1
--- Item 1
-- Offset 2
--- Item 2
-- Offset 3
--- Item 3
Title: Re: Scroll View doubts
Post by: Tatanan on July 15, 2014, 05:57:08 AM
Thank you for your answer.
I was able to fix the center issue with your 2nd suggestion.

I still have 2 unfixed problems (maybe I'm just not good enough):

Thank you.
Title: Re: Scroll View doubts
Post by: Tatanan on July 15, 2014, 06:01:23 AM
By the way, I need all that for any resolution between 4:3 and 16:9.
Maybe the only solution is by programming. If so, it's ok, I'll programme it, but maybe it's just that I don't know how to set up NGUI properly.
Title: Re: Scroll View doubts
Post by: wallabie on July 15, 2014, 08:10:12 AM
I had previously asked to do the same thing. It looks like there is a real need for this functionality. Perhaps it's a good time to build this into NGUI because this issue will come up again as more people are trying to replicate how most scrollviews work.
Title: Re: Scroll View doubts
Post by: Tatanan on July 15, 2014, 08:12:48 AM
I agree with you wallabie.
I am sure that it can be done with programming, but I also guess there should be a way to do with some kind of trick with current NGUI, like you can use "offset gameObject for aligning on the left". Maybe admins can help us :)
Title: Re: Scroll View doubts
Post by: ArenMook on July 15, 2014, 09:46:37 PM
@Tatanan: My answer to your #1 is my #1. Don't use a unified anchor. Use an advanced anchor, anchored only on the axes that aren't being scrolled. Unless you mean aligning the button horizontally, as well as have the scroll view scroll horizontally? If so, UpdatePosition() on the scroll view (or ResetPosition()), provided you chose the Content Origin to be on the left-hand side.

In regards to your #2, that's how the UICenterOnChild script works. It centers on the child (with your offset). If you wanted to restrict it to not scroll past the edges, then it wouldn't be centering anymore at all, would it? How would you even show that your "centered" item is changing if it's locked to not move anymore past a certain point? It sounds like you shouldn't be using the UICenterOnChild script anymore at this point. You need too much custom functionality from it. You will want to write your own script.