Enabling a disabled Canvas containing a ScrollRect makes the content jump to the bottom
I've spotted some odd behaviour of ScrollRect while trying to set its initial scroll position when it first becomes active. I've made a simple scene which highlights the problem. In it:
I have a couple of canvases which I can switch between dynamically; buttons to SetActive() the canvases (True or False as required).
The first canvas is active when scene loads, the second canvas is inactive when the scene loads.
The ScrollRects within both canvases are the same (the 2nd canvas is a duplicate of the first; it was just set as inactive to start).
Run the scene in the editor, and notice the scroll rect and content are at the top and it is possible to scroll down.
Click the button on the right to active the second canvas (deactiving the first), and the content of the ScrollRect is NOT at the top. Usually it is at the bottom.
From some testing with a component to view the values, it looks like something between 'OnEnable' and the first 'Update' of the ScrollRect is messing with the position of the ScrollRect when it is SetActive().
My question is: What is going on here?
Here is a scene demonstrating the problem
Your answer

Follow this Question
Related Questions
SetActive canvas relative to selected object 0 Answers
Growing menu with scrollbar 1 Answer
Canvas prevents child scroll view 0 Answers
UI ScrollRect is bouncing back to Origin 2 Answers
Getting component from derived classes 0 Answers