how to Swipe 2 GUI Button position???

HI
I am new in unity.
I need to swipe 2 GUI Button position.
when I click button1 it will take position of button 2 and button 2 will take position of button 1.
And
Again when I click button2 it will take position of button1 and button1 will take position of button2.
Please help me :frowning: :frowning:

Hello,

you can realize this with a Script which is attached to both buttons.
if both buttons are available, you should just add a script which is doing the following

  1. grab the second button over GameObject.Find(“Button2”).gameobject;
  2. grab the position of the second button and save it in a temporary vector with Vector2 temporaryPosition = button2.transform.position;
  3. grab the position of the first button and tell the second button over button2.transform.position = button1.transform.position; that it shell take the position of the first button.
  4. now tell the first button to take the position of the second button via the temporary position via button1.transform.position = temporaryPosition;

basicly its the hanoi logic. using a third spot to switch values easily.

Greetings
Gardosen