The scrollrect viewport breaks when changing scene
I have a scrollRect set up with some text as content. It's working fine when I just play the scene. The Viewport looks like this in the inspector.
The problem is when I load this scene from another scene, the viewport behaves weirdly. Here is what it looks like in the Inspector when loaded from other scene:
As you can see the Rect Transform component values change (the anchoring preset and the delta size). I'm assuming the reason the content disappears is because of this, but I'm not sure.
If I change some of the viewport rect transform values (position for instance) when the game is paused it resets back to normal when I resume. It doesn't work if I do the same in the script, though.
Unity version: 5.4.1f1 Personal
Any help is appreciated, it's driving me crazy. Thanks in advance and sorry for any english mistakes.
Answer by rytis6lod · Jan 26, 2017 at 02:56 AM
I had a similar issue and I've managed to find a workaround.
In my case, the "Visibility" property of the horizontal and vertical scrollbars in the ScrollRect were both set to "Auto Hide And Expand Viewport". By setting them to either "Permanent" or "Auto Hide", the ScrollRect wasn't messed up anymore when changing scenes.
Not ideal, but it might be good enough depending on the situation. I tested this on Unity version 5.5.0 f3.
Answer by hippogames · Oct 21, 2017 at 10:32 PM
The same problem and the same solution. Hope this is Unity bug. Reproduced in Unity 2017.
Your answer
Follow this Question
Related Questions
changing scene not working? 0 Answers
Problem with changing scenes: Stuck in a loop where two scenes keep loading each other 0 Answers
GridLayoutGroup issue after loading scene and dynamically adding Instances 1 Answer
How to fill a bar constantly between two variables? 1 Answer
My game screen is getting blue for 1 or 2 seconds when i am requesting and getting response ? 0 Answers