Skip to content

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

@SimonDarksideJ
Copy link
Contributor

Apologies for the delay, will get this reviewed asap

@SimonDarksideJ SimonDarksideJ merged commit 39a3b8d into Unity-UI-Extensions:development Mar 29, 2025
@hugoymh hugoymh deleted the HSS-VSS-fix branch July 7, 2025 04:06
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.

2 participants