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

VirtualizedScrollRectList spawns pool items at an angle[BUG] #534

Closed
johannes-weidenfeller opened this issue Oct 31, 2023 · 1 comment
Closed
Assignees
Labels
Package: UX Core The Project ux core package is impacted by this issue. Type: Bug A problem with an existing feature that can be fixed with the next patched release.

Comments

@johannes-weidenfeller
Copy link

Describe the bug

When using the VirtualizedScrollRectList, the pool item prefabs are spawned as children of scrollRect.content with an initial rotation of Quaternion.identity. If the ScollRect or content are rotated, this will spawn the pool items at an angle to the ScrollRect whereas the desired behaviour is probably to spawn them aligned.

To fix the issue we can replace line 414 in VirtualizedScrollRectList.cs
GameObject go = Instantiate(prefab, ItemLocation(-(i + 1)), Quaternion.identity, scrollRect.content);
with
GameObject go = Instantiate(prefab, ItemLocation(-(i + 1)), scrollRect.content.rotation, scrollRect.content);
which produces the expected behaviour.

To reproduce

Steps to reproduce the behavior:

  1. Add a virtualized scroll rect list to a canvas in the scene
  2. Rotate the (parent of the) canvas by some angle

Expected behavior

The children should spawn aligned with the ScrollRect/its parent canvas.

Screenshots

image

Your setup (please complete the following information)

  • Unity Version 2021.3.19f1
  • MRTK Version 3.0.0-pre.18
@johannes-weidenfeller johannes-weidenfeller added Needs: Triage Needs to be triaged. Type: Bug A problem with an existing feature that can be fixed with the next patched release. labels Oct 31, 2023
@shaynie shaynie added Package: UX Core The Project ux core package is impacted by this issue. and removed Needs: Triage Needs to be triaged. labels Oct 31, 2023
@shaynie
Copy link
Contributor

shaynie commented Oct 31, 2023

@johannes-weidenfeller Thanks for the bug report. Your proposed solution works as written, would you like to submit a pull request? Please see the contributor guide if you'd like to submit the fix, otherwise we'll add it to the backlog and get it in a uxcore package release.

shaynie added a commit to shaynie/swhMRTKFork that referenced this issue Nov 2, 2023
shaynie added a commit that referenced this issue Nov 2, 2023
…536)

* Instantiate list items with parent's rotation

* Update uxcore patch version for the virtualizedscrolllist item instantiation fix (#534)
@shaynie shaynie closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: UX Core The Project ux core package is impacted by this issue. Type: Bug A problem with an existing feature that can be fixed with the next patched release.
Projects
None yet
Development

No branches or pull requests

2 participants