Is it possible to get the button position using script?
How do i get it.
I want to swap two buttons after getting their present position in the screen.
Please Help
Is it possible to get the button position using script?
How do i get it.
I want to swap two buttons after getting their present position in the screen.
Please Help
I would create a temp variable of Vector3 and set:
temp position = button1 position
button 1 position = button 2 position
button 2 position = temp position
to get 3D position of an object use transform.position
to get 1D position of an object use transform.position.x / transform.position.y / transform.position.z
Hope this helped
The transform has the position of all Unity game objects. You want to use something like gameObject.transform.position;
I have never seen a game object in unity that had not transform attached to it. That includes the UnityEngine.UI