Author Topic: UICenterOnChild not working correctly on first attempt of slide  (Read 3888 times)

razil_zul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UICenterOnChild not working correctly on first attempt of slide
« on: January 22, 2014, 02:42:20 AM »
UICenterOnChild is not working correctly on first attempt of slide. Even when i set the threshold to 1, the first attempt of sliding in a group of sprites will not change to the next sprite. Only when i retry the swipe the second time onwards than it will work as per normal.

This happens on both editor and also on mobile. I tried it on a new project and same thing happens so quite sure theres a bug on the script.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICenterOnChild not working correctly on first attempt of slide
« Reply #1 on: January 22, 2014, 05:15:15 AM »
"First attempt of slide"? I'm not sure what you mean.

razil_zul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UICenterOnChild not working correctly on first attempt of slide
« Reply #2 on: January 22, 2014, 05:18:17 AM »
the action of swiping to the next item in the uiscrollview. It feels as though it is not following the threshold set in the UICenterOnChild when you are swiping for the first time so it just reverts back to the first item instead of shifting position to the second item.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UICenterOnChild not working correctly on first attempt of slide
« Reply #3 on: January 22, 2014, 05:24:14 AM »
The logic for it is dead-simple, so I'm not sure how that would be the case. Have a look at UICenterOnChild line 112. The only way I see it not working would be if the UICenterOnChild script is not actually centered on anything yet.

razil_zul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UICenterOnChild not working correctly on first attempt of slide
« Reply #4 on: January 22, 2014, 08:18:00 PM »
yea got it working now! all i needed to do was ensure that the first item was centered by manually calling CenterOn() on the first item of the list and now its working perfectly! Thanks for the help!