Hi,
I'm implementing a slots game and using 5 vertical ScrollViews for 5 reels with symbols on them.
I use a sequence of tweens to animate the ScrollReel.transform.localPosition and ScrollReel.GetComponent<UIPanel> ().clipOffset (inversed value). This works fine and I get the desired motion effect with nice bounces etc.
However I foresee a problem, the Y position of Transform (and it's inversed negative ClipOffset friend) tend to increase a good amount with every slots spin. This can lead to really big numbers after several thousands of spins and I'm afraid of overflows. And it's generally not too nice to let variables get this high. Also, the tweens somehow are not too precise and sometimes the reels do not stop at the exact position.
I've tried all I could think of, to reset ScrollReel Y back to 0 (this should do the trick, as the moving reel always stops at 0 object location)
1) This does the trick, but produces nasty flickering
offset.y = 0.01f;
ScrollReel.transform.localPosition = offset;
2) This does the trick, but is not invinsible to the user & leads to the reel disappearing ocassionally
offset.y = 0.01f;
SpringPanel.Begin (ScrollReel, offset, 1000000f);
What I'm looking for is a method to reset the Y coordinate of the ScrollReel back to 0, the sprites are the same, I just need to reduce the flickering and noticeable reel movement while doing that. I know a workaround (placing duplicate sprites in front of the scroll wheels) but it's painful & maybe you have better considerations. Maybe there's a way to turn off the draw calls while changing the Y location.
It's my first day in Unity so don't judge too strictly. Thanks!