Search Unity

Potential Bug: ScrollRect and Animations involving RectTransform.localScale

Discussion in 'UGUI & TextMesh Pro' started by Saruto, Jan 9, 2015.

  1. Saruto

    Saruto

    Joined:
    Aug 24, 2014
    Posts:
    4
    I'm having a problem with animating a ScrollRect GameObject. I have 2 simple animations - FadeIn and FadeOut - that smoothly change a GameObject's RectTransform's localScale from zero to one and vice versa. I have a parent object to which I apply the Fade animations, and that parent also holds a child GameObject that uses a scroll rect, image, and mask. Like any other scroll rect, the child also has children that makes up the content of the scroll view window.
    When I apply the animations to the top most parent object, the scroll view window seems to scroll by itself a little bit. To clarify:

    before.png
    A scroll rect window with a vertical slider bar before any animations have been played. The scroll view window is restricted so that it can only scroll vertically.

    after.png
    The same window after a single FadeOut -> FadeIn cycle.
    Repeating the Fade cycle has the same effect; the scroll rect scrolls down by a little bit after each cycle.

    Even stranger, the window only sometimes scrolls down. Other times it stays in the exact same position like you'd expect, which makes the problem all the more frustrating.

    After a little bit more testing, it seems like it's the FadeOut animation specifically that shifts the scroll rect down, but I still have no clue why it has this behavior. I've tried every kind of anchor possible, but nothing I change there seems to have any effect on the problem.

    Have I stumbled upon a bug about ScrollRects and animations involving scales? or have I done something horribly wrong? Any help is greatly appreciated.
     
  2. alexjolig

    alexjolig

    Joined:
    Jul 26, 2016
    Posts:
    3
    Its 2017 and its still a bug in 2017.1 version :|
     
  3. wolilio

    wolilio

    Joined:
    Aug 19, 2019
    Posts:
    29
    the bug is still there in 2019.x .the reason may be ScrollRect use GetWorldCorners and worldToLocalMatrix which relate to the scale .
    in my case ,i use a tiny scale (such 0.001) instead of 0 ,it help me
     
    gabrielgardner likes this.