#OnDrag & OnEndDrag not reporting updated y coords for rect transform

1 messages · Page 1 of 1 (latest)

lament jacinth
#

Trying to get a scroll rect grid to only scroll so far up and down, reactive to different resolutions. Mouse scroll wheel is a little buggy, but snaps back, dragging though causes it to completely disregard the position of the rectTransform, meaning it'll never snap.

Snap code is just if the y value goes above or below a certain value, it'll go to that value. Debug logs show the y value is never being updated like with scrolling despite being literally the exact same code. y = menuRect.rect.y. that line is being called every time it's dragged, it's just never reflecting the actual rect's y value but only on dragging, not scrolling.

A quick Google saw some people mentioning this possibly being an engine bug, or relating to one? Unity version 2021.3

lament jacinth
#

Now it doesn't seem to be updating at all for anything 😭 even if I stick that y assign into the update function