Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excess snapping animation to Starting Panel with no 'Use Automatic Layout' #16

Open
Maligan opened this issue Nov 6, 2022 · 1 comment

Comments

@Maligan
Copy link

Maligan commented Nov 6, 2022

In case of using non automatic scroll-snap layout there is a problem with excess animation lerp to the first panel.

These lines in Setup can fix this behaviour:

private void Setup()
{
    ...
    
    // Starting Panel
    ...
    
    Vector2 targetPosition = -Panels[CenteredPanel].anchoredPosition + offset;
    Content.anchoredPosition = targetPosition;
    
    // Buttons
    ...
}

Or may be you can consider another solution.

@Maligan
Copy link
Author

Maligan commented Nov 16, 2022

Oh, I've made a mistake, there is already start Content.anchoredPosition calcualtion.

The problem is Setup() is calling from Start() which execute before Unity Layout system calculate new correct positions for layout elements.

Possible solution is move Setup() method at the very first Update() call...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant