Getting the position of a RectTransform
I've been trying to save the starting position of a UI image so I can later snap it back in place. But I've been having trouble saving the starting position, when I use objectPos = GetComponent(); and startPosX = objectPos.anchoredPosition.x;, and later objectPos.anchoredPosition = new Vector2(startPosX, startPosY); to snap it back, it ends up in the wrong spot, in the upper left corner. I am using a Grid Layout since I have many images I want to snap back. Any ideas on how I can get it to work? Thanks in advance!
Your answer
Follow this Question
Related Questions
Scaling an image sent to UI Image 0 Answers
Unity 5 change source image of UI image c# script 2 Answers
Events not working when UI y rotation is not 0 0 Answers
Problem with reticle and image 0 Answers
How to move a UI Image in the z axis? 2D 0 Answers