Unity-UI-Extensions / com.unity.uiextensions

https://unity-ui-extensions.github.io/
1.25k stars 134 forks source link

VerticalScrollSnap - Content moves to the right after some scrolls #323

Closed SimonDarksideJ closed 2 years ago

SimonDarksideJ commented 2 years ago

Issue created by Michael Seeber as Bitbucket Issue #​323 on 2020.06.08 20:39. I came across the following: Initially everything gets setup correctly, however after some scrolls the placement panel moves to the left, resulting in the content to move to the right. Attached you can find a screen capture showing the error.

Sadly I wasn’t able to directly upload the TestProject but here it can be found: https://1drv.ms/u/s!Am5y6cxhvB-mlIQ08IR-1590Bv1ykw?e=k8Xryh

SimonDarksideJ commented 2 years ago

On 2020.06.22 15:34, @SimonDarksideJ commented: Finally getting to look at this issue today. It has cropped up intermittently in the past but never been a real issue.

However, your project manages to replicate it 100% of the time, so thank you.

Sadly the issue is still just as baffling, but working through all possible angles to figure out what is going on.

SimonDarksideJ commented 2 years ago

On 2020.06.22 15:46, @SimonDarksideJ commented: Finally figured it out and testing a fix. For information, the control has always used the control’s LocalPosition for reference in scrolling, however, for some reason that now causes the placement of the control to offset as the local position is now the center of the control.

Switched to using the AnchoredPosition and everything is back and working.

SimonDarksideJ commented 2 years ago

On 2020.06.22 16:02, @SimonDarksideJ commented: @{557058:9ae2d641-e086-4487-847a-759b2aa5886d} @{557058:e219eca8-c2ff-42a1-ba44-9503e7805353} (Sorry for pinging both accounts, as Bitbucket isn’t great for identifying the specific user)

I’m pushing up a fix for the issue, which should resolve the undesired effect you were seeing.

In the way Unity UPM works, you might need to remove and then re-add the package to get the fresh source. Can you test and let me know if this works for you and close the issue.

SimonDarksideJ commented 2 years ago

On 2020.06.23 11:33, Michael Seeber commented: @{557058:da9b1be2-6172-44a5-a085-cae5d30eda9e} Thanks for having a look! I pulled a clean copy but in my real project the “same?” error still persists. Scrolling looks to work, but just when the Panel gets disabled, the PlacementPanel enlargers in a similar fashion, i.e. moving again the content out of focus.

SimonDarksideJ commented 2 years ago

On 2020.06.24 22:48, @SimonDarksideJ commented: Possibly Unity isn’t updating the cache for the UPM package because the version hasn’t changed. You might need to clear that cache, details can be found here
https://docs.unity3d.com/Manual/upm-cache.html

Just remove the Unity UI Extensions asset cache and then re-add it to your project.

Once released, this shouldn’t be an issue in the future as we’ll have a proper UPM release cycle.

SimonDarksideJ commented 2 years ago

On 2020.06.29 15:43, @SimonDarksideJ commented: Any update @{557058:9ae2d641-e086-4487-847a-759b2aa5886d} / @{557058:e219eca8-c2ff-42a1-ba44-9503e7805353} ? Were you able to clear your UPM cache?

SimonDarksideJ commented 2 years ago

On 2020.06.29 17:30, Michael Seeber commented: Works! Thanks

SimonDarksideJ commented 2 years ago

On 2020.06.29 17:30 Michael Seeber modified issue: status changed newresolved

SimonDarksideJ commented 2 years ago

On 2020.06.29 17:38, @SimonDarksideJ commented: Great news. I’ve started this weekend to push an actual release and will increment the version number to suit.

This also means reorganising the branches to make it more effective (plus other factors). With this issue fixed, I’ll draw a line under the mountain of updates and package this release :smiley: Thanks for your help in resolving this critical issue.

SimonDarksideJ commented 2 years ago

On 2020.06.30 09:09, Michael Seeber commented: Great! Thanks again for all the good work and this amazing UI extensions!

SimonDarksideJ commented 2 years ago

On 2020.06.30 09:11, @SimonDarksideJ commented: Stay tuned. Will be even trying to get this on the Asset store…. Again :smiley: but they’ve never liked the project in the past for some reason.

SimonDarksideJ commented 2 years ago

On 2021.12.13 09:31, Laurynas Pupsta commented: Hmmm, still happens in 2.2.7 :disappointed:

SimonDarksideJ commented 2 years ago

On 2021.12.13 10:04, @SimonDarksideJ commented: Can you provide replication steps and a video if possible @{5e7cbe8197217f0c34540ff5} please? to help further diagnose what you are seeing.

SimonDarksideJ commented 2 years ago

On 2021.12.13 10:34, Laurynas Pupsta commented: Absolutely. It’s actually not the first time I’ve encountered this specific problem, but managed to solve it by deleting the VerticalScrollSnap and recreating it. That time, the problem was with a single verticalScrollSnap component.

However, this time I had to replace the component to FixedItemScroll to solve the problem. Recreating the Vertical Scroll Snap component, does sometimes work, but after reloading the scene, same thing happens.

The setup is:

Canvas → World Space

→ GameObject with Rect2DMask and modified position

→ → HorizontalScrollSnap (with scrollRect component disabled, as I only use navigation buttons to scroll left or right and to not block verticalScrollSnaps inside)

→ → → VerticalScrollSnap 1

→ → → VerticalScrollSnap 2

→ → → VerticalScrollSnap 3

→ → → VerticalScrollSnap 4 (this component slides to the right by a lot on enable/disable or after an interaction)

video https://drive.google.com/file/d/1PenajpxphZXTtfFN8yGBoAz6v43uO7xd/view?usp=sharing

EDIT: Have noticed, that the problem sometimes starts occurring, when copying the whole VerticalScrollSnap gameObject, but haven’t managed to recreate it 100%.