Trying to achieve a CenterOnChild behaviour with ScrollRect (HELP)

I’m trying to achieve that behaviour to achieve a ViewPager:

The approach should be “easy” because ideally you only have to:

  • Get ScrollRect “content” property current position.
  • Compare it to every child position and find who it’s closer to that.

My problem is:

  • I don’t know how to get each child position regardless if they are child of a layoutgroup (and padding, spacing…) or not, it’s pivot or it’s parent pivot, etc…
  • How once I have each child correct coordinates and I have determined which child it’s closer, how to tell the ScrollRect to move to that position considering that it can have it’s inertia/elastic/etc settings enabled (I want to not collide with this when moving).

Can you help me Tim, rune, etc…?

Anyone?