The place to chat about all things UI Extensions :D - Keep it clean and be friendly to everyone.
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);
}
DistributePages
function to reset the view. I'll try and do some testing with this approach and maybe add another example. Let me know if this works for you.
update
for making alterations to UI controls, always use LateUpdate
Just Because Unity... :D (has to do with the execution order for when the UI is updated). Better to plan updates for the start of the next frame than try to alter UI before render.