ScrollRect content anchoredPosition not being updated in 2017.3.1p1

Hi there,

We recently upgraded our project from 5.6.1 to 2017.3.1p1. Ours is a very UI-heavy project, that relies a lot on ScrollRect’s functionality.

We have a class that inherits from ScrollRect. In Update(), it sets horizontalNormalizedPosition to some value, then reads content.anchoredPosition back (which should be internally modified by ScrollRect when setting the horizontal norm position, so that both are in sync). Actual code:

public void Update(){

        Vector2 cursorInViewport = viewport.InverseTransformPoint(cursor.position);

        float navigableViewportWidth = viewport.rect.width * 0.5f - scrollMargin;

        float offset =  Mathf.Clamp01( ( cursorInViewport.x - navigableViewportWidth )/scrollMargin );
              offset -= Mathf.Clamp01( (-cursorInViewport.x - navigableViewportWidth )/scrollMargin );

        horizontalNormalizedPosition = Mathf.Max(0,horizontalNormalizedPosition + offset * scrollSpeed * Time.deltaTime);

     }

We also override OnBeginDrag, OnEndDrag and OnDrag to get rid of ScrollRect’s default interaction. Scrolling is instead controlled by the position of a cursor object, relative to the scrollrect’s viewport.

This works just fine inside the editor. However once we build the standalone version (Windows or MacOS), anchoredPosition remains (0,0) no matter what.

We’re extremely confused by this behavior, specially since it worked fine in 5.5 and 5.6 (both editor and build), and works inside 2017’s editor, but does not work in the build.

We have searched the forums and the bug tracker for something similar, but could not find anything. Any hints on what is going on?

After taking a look at the UI source code changes in 2017, I saw this:

https://bitbucket.org/Unity-Technologies/ui/pull-requests/63/fix-after-setting-normalizedposition/activity

Which is exactly the problem we are having. Could this be the culprit? If so, has this fix been included in a later Unity patch? We’d like to get the fix as soon as possible, as our entire UI is unusable as a result.