Author Topic: NGUI vertical scroll bar issue  (Read 3568 times)

isperia

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
NGUI vertical scroll bar issue
« on: February 24, 2014, 03:49:31 PM »
Hello, everyone.

Have an issue with my vertical scroll view.
The issue is on the video:
http://www.youtube.com/watch?v=d9q6hN2vLP4

as you can see, horizontal scroll works fine, while vertical scroll view disappears after I scroll down.

The hierarchy is as follows:
Panel
->Scroll View
   -> Grid
        -> Elements

The code that adds elements to grid:
  1. if (!found) {
  2.                         //we did not found model in the deck
  3.                         GameObject objSmallController = NGUITools.AddChild(gridDeck.gameObject, prefabSmallPileController);
  4.                         CardPileSmallController ctrl = objSmallController.GetComponent<CardPileSmallController>();
  5.                         ctrl.editor = this;
  6.                         ctrl.ApplyModel(pile);
  7.                         objSmallController.transform.localScale = new Vector3(0.70008f, 0.70008f, 1.00008f);
  8.                         gridDeck.Reposition();
  9.                         UIDragScrollView scrollBehaviour = objSmallController.GetComponent<UIDragScrollView>();
  10.                         scrollBehaviour.scrollView = scrollDeck;
  11.                 }

Please give some advice what can cause such kind of problem so I can start tutoring in that direction

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI vertical scroll bar issue
« Reply #1 on: February 24, 2014, 04:47:25 PM »
Something is wrong with your vertical scroll view's setup. Check the transform scales of all objects leading up to your scroll view, and the scroll view itself. Everything should be using (1, 1, 1).

In the code you posted, you are using a non-uniform scale. This is bad. You need it to be uniform -- ie: X, Y, and Z must all match.

isperia

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: NGUI vertical scroll bar issue
« Reply #2 on: February 25, 2014, 04:12:25 AM »
Currently I'm using scale for the whole component that contains lots of stuff in order to fit the screen.
What is the alternative way to make layout that will fit ANY screen?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI vertical scroll bar issue
« Reply #3 on: February 25, 2014, 01:57:08 PM »
I'm not sure what you mean by what you're trying to accomplish. Scale to fit on the screen? If you set UIRoot to fixed size, nothing ever needs to scale.