The place to chat about all things UI Extensions :D - Keep it clean and be friendly to everyone.
public HorizontalScrollSnap hss;
// Start is called before the first frame update
void Start()
{
hss = GetComponent<HorizontalScrollSnap>();
}
// Update is called once per frame
void Update()
{
//Checking for the Currentpage
var theSelectedPageIs = hss.CurrentPage;
}
Thanks for the feedback @pdeclercq , Can you log an issue on the bitbucket with replication steps and of possible a demo scene showing the issue.
I'm not 100 % sure how to replicate it, i can't send a demo because as i said i found a solution (and didn't really think things through), but the main point is, if you move to a index using GoToScreen(index) while the scrolling is decelerating, it can go to the index + 1 or - 1 depending on the velocity (left to right / right to left)
Simply query the CurrentPage variable of the HorrizontalScrollSnap component, as follows:
public HorizontalScrollSnap hss; // Start is called before the first frame update void Start() { hss = GetComponent<HorizontalScrollSnap>(); } // Update is called once per frame void Update() { //Checking for the Currentpage var theSelectedPageIs = hss.CurrentPage; }
oh I understand now, Thanks a lot. I was trying to reference the variable directly in HSS script.
Not sure if this is known, but I've just created an issue regarding the Content Scroll Snap Horizontal. I know I must be a pain finding issues with this one control :P
https://bitbucket.org/UnityUIExtensions/unity-ui-extensions/issues/362/bug-single-child-in
A very Merry Christmas and a happy new 2021 to all users of the Unity UI Extensions project. We're truly honored you chose to include us in your project and just as happy it helps you be successful faster and quicker!
If there is something else you need in the UI world, let us know on the BitBucket site and we'd be happy to help.
Scenario:
Then GetScrollOffset is called with the following values
UIScrollToSelection.GetScrollOffset(position = 0, listAnchorPosition = 0, targetLength = 100, maskLength= 708)
And returns the value = 808
Which leads to a change in the verticalNormalizedPosition from 1.0
Before: TargetScrollRect.verticalNormalizedPosition 1.00
After: TargetScrollRect.verticalNormalizedPosition 1.06...
Which in ScrollRect.MovementType == Elastic leads to the flickering movement.
So in GetScrollOffset() for a position that requires 0 scrolling ( as i see it, correct me if i'm wrong ),
this leads to scrolling of 1 heigth of the control, if there's less than 0.5 height of the control distance the the top border.
if (position < listAnchorPosition + (targetLength / 2))
{
// 808 = ( 708 ) - ( -100)
return (listAnchorPosition + maskLength) - (position - targetLength);
}