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

force ScrollRect.content setup [re-submission] #485

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

hugoymh
Copy link

@hugoymh hugoymh commented Oct 17, 2024

Unity UI Extensions - Pull Request

Overview

**this is a resubmission of PR#484,re-targeting to development branch
Added a minor change in ScrollSnapBase to setup HSS/VSS properly in code.

Changes

In order for HSS/VSS to work properly, the Content RectTransform under ScrollRect must have the anchors setup as stretched to the four corners and also has the same rect dimensions of its parent RT before <HSS or VSS>.DistributePages() is executed.

The added code forces these parameters in case they are not setup properly in Unity Inspector

inside ScrollSnapBase.Awake() :

_screensContainer = _scroll_rect.content;

//ScrollRect.content RT anchors has to be stretched first in order for HSS/VSS.DistributePages() to have the correct result
_screensContainer.anchorMin = Vector2.zero;
_screensContainer.anchorMax = Vector2.one;
_screensContainer.sizeDelta = Vector2.zero;

Testing status

  • No tests have been added.

Manual testing status

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

Successfully merging this pull request may close these issues.

1 participant