Scrollview margins around content

I am populating the Contents of a Scrollview with a list of text generated from a script. The structure of the Scrollview is Scrollview > Viewport > Content. I’ve set the anchor preset of the Content game object’s pivot and pivot position to the top left corner with Pos X = 7 and Pos Y = -7 to try to give the text a margin.

When I run the game in the Unity preview, the Pos Y position is reset to (almost) zero.

When I stop the game in the Unity preview, the Pos X and Pos Y are reset to zero.

How do I give the contents of my Scrollview a margin?


Use a Vertical or Horizontal Layout Group component on your content object to give it padding. You can then set the left and top values to give it the needed padding amount.

Good luck with your project!