Anchor behaviour: can you explain to me what it does?

For me it is
image

But you can try

I was using anchor at 1st but i found that changing position of objects is easier for me to manage
I can’t say position change is better i can only say it is better for me
So i say you try both and pick whichever suits you more

Imagine you have button
You want to position it somewhere on screen to be always in that position

Let’s go with top left corner
I change its X pos to CameraBorderLeft()
And Y to CameraBorderTop()

But that makes it exactly as edges of top and left edges of screen
That is why i add some offset to it for example
CameraBorderLeft()+10
CameraBorderTop()+15

Which means it will go to left camera border + 10 pixels right
And top camera border + 15 pixels down
On X axis - means more to the left + more to the right
On Y axis - means more up and + more down

But there is 1 more thing
If you want to put that button on bottom right corner with same 10 and 15 offset
You need
CameraBorderRight()-Button.Widht()-10
CameraBorderBottom()-Button.Height()-15

If you don’t add that width and height of your object to expression
Then it will move to beyond screen

Cause change X and Y takes origin point as reference
So for everything by default it is top left corner of object

And armed with that knowledge you can position anything anywhere anytime
Well maybe also
CameraCenterX()-Button.Widht()/2
CameraCenterY()-Button.Height()/2

For placing such button on center of screen

Now you can try it out
I suggest testing placing some object to at any camera border
After like 3 mins you will have perfect understanding how it works
And you will be able to decide do you want change position or anchor your objects

1 Like