Give Random location to button

Need to move button to different location i.e may be centre or right side?
when i try I can move button to left side/top and bottom?

How can i give random location to button on scrren?

You could create a lot of buttons that become invisible and visible depending on what you want to do. :wink:.

Each component alignment in an arrangement has an equivalent in numbers. You can randomly set the button in 9 places of the arrangement. All you have to do is randomize two numbers and substitute them for vertical and horizontal alignment.

You can do random button using a Canvas component and ImageSprite instead of a Button.
Look at the logic below, it looks simpler and easier, right?
That's because you can set the x-axis and y-axis easily, so what are you waiting for?
let's use a canvas component :wink: :+1:


Aia Project :
Example1.aia (8.4 KB)

1 Like

use this extension -

I think my incorrectly wrote Random.
What I want to do is:
I can place button freely at some location on given screen?
Write know I can place button on left side of screen, when I try to move it to centre, button automatically gets back to left side again.

suppose I want to have three buttons:
a) Ok, cancel
b) Retry

1 Like

You must use the arrangement. You must extend the arrangements to the size of the parent. Put the button in the arrangement. In the arrangement, set alignment e.g. to the center or to the right.

See this example:
arrangement.aia (1.2 KB)

Thx so much brother

1 Like