|
Post by rpm886 on Apr 16, 2019 13:02:55 GMT
Hi
We have a scroller that is scrolling a number of items across the screen when a right or left arrow is pressed on the keyboard. Looping in turned on.
We would like the cell being jumped to by index to be centered in the screen. The following parameters are set for the JumpToIndex method.
scrollerOffset = 0.5 cellOffset = 0.5 tweenType = EaseOutSine; tweenTime = 0.25; LoopDirection = LoopJumpDirectionEnum.Closest;
myScroller.JumpToDataIndex(jumpCount,0.5f, 0.5f, true, hScrollerTweenType, hScrollerTweenTime, this.MyJumpComplete, LoopDirection);
Everything works fine for a large number of cells (where cells widths combined are greater than screen width, HOWEVER where the number of cells is greater than the screen width it does not jump to the right index.
We have tried setting the LoopDirection to different setting and nothing is correcting this.
Is there a way to fix this? Is there another way to accomplish this?
Thank you for any assistance.
Bob
|
|
|
Post by echo17 on Apr 16, 2019 15:46:14 GMT
If you could put together a simple project that demonstrates the issue, I can take a look. Please see this FAQ: link
|
|
|
Post by rpm886 on Apr 16, 2019 18:01:15 GMT
Please find attached a project called UnityScrollSmallDataSet.
The Scene is called CardSlots
Notice the parameter "DataSize" on CardSlotController.
If you run with DataSize set to 12 or higher as you hit the arrow keys the "cards" work as expected.
If you change the size to 4 you will see the index of the cells are not working correctly.
Thanks for the help
|
|
|
Post by echo17 on Apr 17, 2019 15:15:35 GMT
So it looks like several things are happening here, the biggest of which is a bug in the EnhancedScroller code.
TLDR: I will test and get an update out for the EnhancedScroller to fix jumping while looping on small data sets. There were also some settings in your scene that were causing issues. I created a simpler project that got around these issues.
Full Explanation:
The ES code simulates a loop by adding extra data elements at the beginning and end of the scroller so that it has the illusion of going on forever. When scrolling or jumping, the scroller is actually resetting its position to stay within these three sets of the same data. When a small data set is used that does not take up the entire scroller size, even more extra sets of data have to be added as padding. I was not accounting for these additional extra sets of data when jumping while looping on small sets. It was mistakenly jumping to a position where it assumed only three sets of data. I have corrected this and will publish an update after more extensive regression testing.
I have emailed you a link to the fixed project so that you can see this in action.
Some of the other issues in your scene:
1) You are not setting the loop before calling ReloadData, so the scroller does not know it needs more sets for padding 2) You have snapping set on the scroller which conflicts with jumping. Snapping is for dragging on the scroller, jumping is moving the scroller programmatically. 3) Other issues were also interfering with the looping, but I could not identify them. I created a new scene for you that is simpler and focused on the issue of the loop jump.
|
|
|
Post by rpm886 on Apr 18, 2019 18:29:01 GMT
Thank you for the fix.
Not sure if you noticed but there is also a jitter in the Animation that we can't figure out.
(might be what you where referring to with 3.))
We are running unity version 2018.3.0f2
If we run the project on an older release( lts2017.4) the jitter issue goes away.
Bob
|
|
|
Post by echo17 on Apr 19, 2019 13:09:11 GMT
I am only seeing the jitter in the original CardSlots scene. The CardSlots2 scene that I created using a simplified controller script doesn't seem to have this issue, at least on my machine. My advice would be to selectively eliminate portions of your code until the jitter goes away. It may be one thing or a combination of processes that are causing it.
|
|