5.5 C
New York
Friday, November 14, 2025

Tips on how to stop Unity’s ScrollRect from transferring as content material dimension modifications?


I am writing a Textual content-RPG and have arrange a ScrollRect the place new paragraphs and choices are added and eliminated on a regular basis. This causes the dimensions of the Content material to always change, which I deal with with a Content material Dimension Adjuster.

To forestall the participant from shedding monitor of the final paragraph they have been studying earlier than making a choice, I wish to hold them in the identical place relative to the display no matter modifications to the Content material. Nonetheless, this isn’t potential as a result of clamped Setting the kind of motion of the ScrollRect. I need to hold the conduct restricted to keep away from infinite scrolling, however I must discover a approach to make it work whereas sustaining the place of the final paragraph.

Here’s a visible illustration of what I am attempting to realize:


Desired behavior (correct)

Set the ScrollRect motion sort to unrestricted causes the conduct I am searching for. Nonetheless, I am unable to enable the content material to scroll endlessly. If there’s a workaround for holding a ScrollRect with out constraints, that is likely to be an answer… I would like to know!

I’ve additionally thought-about instantiating an empty block that takes the dimensions of the choices block to cowl the house marked in crimson. Nonetheless, that causes extra issues for the reason that participant can choose an choice whereas the scroll shouldn’t be all the way in which to the underside. I actually do not know how you can make that work.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles