How to get and change RectTransform position (Left, Right, Top, Bottom) values through the script? (theres a screenshot)
Hi, i wanna get and change RectTransform position through c# script.
I have a variable: Public RectTransform OBJ;
I wanna get and change position value , i tried to do that using: OBJ..rect.Set (100f,10f,0f,0f); but it does not work
I am reminding, i wanna change (Left,Right,Top,Bottom) values
Answer by SKGamesStudio · Dec 04, 2018 at 06:21 PM
Hi one more time, I solved this problem, the question is closed, and pay attention to the numbers in brackets, you should have minuses before numbers like mine, after, you can write any (float) number, i wrote 50 or i could write 199.68f
Answer by ierecumi_unity · Oct 21, 2021 at 05:30 AM
Public RectTransform OBJ;
private void Awake()
{
OBJ= GetComponent<RectTransform>();
}
private Updata()
{
OBJ.anchoredPosition = new Vector2(100, 100);
}
Your answer
Follow this Question
Related Questions
Image bounds miscalculated? 1 Answer
Setting value in inspector does not update script. 0 Answers
Custom Editor: Changing isExpanded from another editor 0 Answers
Unity can't see any scripts 0 Answers
No overload for method. 1 Answer