Author Topic: SpringBoard is stopping when Start()  (Read 3923 times)

Prin_E

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
SpringBoard is stopping when Start()
« on: March 04, 2014, 08:36:25 AM »
Hi,
I'm using NGUI 3.5.3 (updated today  :))

I placed scroll view on my panel and referenced by my simple script.
and I added UICenterOnChild component on scroll view.

I wrote...

Quote
void Start() {
    // .... scroll view item creation...
   centerOnChild.CenterOn(center_item);
}

like this.

but, scroll view couldn't actually move item center.
I checked game object, and i found that spring board is disabled.  ???
After some debugging, I found the reason...

when UIScrollView's first update, it disables spring board itself... This is strange  :-[
actually, I solved this problem with moving instantiated all items directly (transform.localPosition += offset for each)..
but I hope re-enabling spring is called after first update in next version.

Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SpringBoard is stopping when Start()
« Reply #1 on: March 05, 2014, 06:08:54 AM »
UICenterOnChild performs the Recenter() when it's enabled. UIScrollView doesn't do anything when it starts up, and it has no Update() function.

Prin_E

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: SpringBoard is stopping when Start()
« Reply #2 on: March 05, 2014, 08:21:17 PM »
Hmm...

UICenterOnChild seems to be working correctly. It adds SpringPanel components on scroll view.

I think the problem is anchor.

I activated Anchor on my scroll view.

On anchoring, UIScrollView.SetDragAmount() is called, and SetDragAmount() disables current spring panel.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SpringBoard is stopping when Start()
« Reply #3 on: March 06, 2014, 10:40:45 AM »
The scroll view activates SpringPanel.Begin only from one place -- RestrictWithinBounds function, line 376 of UIScrollView. What's the call stack for you, where is it being called from?

Prin_E

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: SpringBoard is stopping when Start()
« Reply #4 on: March 07, 2014, 12:35:43 AM »
UIScrollView.DisableSpring()
UIScrollView.SetDragAmount()
UIScrollView.UpdatePosition()
UIPanel.set_baseClipRegion
UIPanel.OnAnchor()
URect.Update()

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: SpringBoard is stopping when Start()
« Reply #5 on: March 07, 2014, 08:59:41 AM »
I see. Well, delay your CenterOn call until the end of frame, and you should avoid this conflict.