Anchor Points Vs Camera Aspect Ratio

So I am thinking this is a noob question but I am honestly confused. I started making a game with no anchor points and just by positioning everything inside the camera. The game is for mobile devices so I was using 16:10 landscape and when i tested it on my phone my game looked just like it did in unity. As I make my Game Window smaller or larger the game still keeps the same ratio. So I assume it will be like that for every different type of phone.

So ultimately my question is do you need Anchor points? I’m planning on making the game landscape only, so if I keep everything inside the camera does unity automatically make the game playable on all mobile devices ? or have I been doing this wrong and should I use anchor points to ensure the game looks the same on all devices? If so what are the differences between using anchor points and just keeping everything within the camera bounds?

Making any game object a child of the game object the camera component is attached to will do nothing to those children in terms of the camera. They are just children of that game object and will move/rotate/scale with that game object (unless moved directly, of course.)

Thanks! but I don’t really understand the answer well.

What I am asking is if anchor points are needed to make your game look the same on all devices. For example I want the game in an iPad to look the same in a Samsung s6, or iPad min etc .

Normally when making apps natively you use anchor points to achieve this. However I noticed that even tough I did not have anchor points on my game, when I resized my game window in Unity the game would automatically scale to look the same. Does this mean that you do not need anchor points in Unity? and if so why have anchor points?

I’m not sure what you mean by “anchor points.” You can construct a hierarchy of game objects in the hierarchy window. This is usually done for two reasons: 1) To create a logical structure, whatever that means to you. 2) To make objects behave in some way, for example, you rotate the parent, and each and every child of that object rotates with it without doing something explicitly to them.

You do not exactly need to create a hierarchy, but it is very useful.

And yes, Unity scales what the camera “sees” to the window by default. But you can of course script the camera to resize itself to mitigate the scaling, if you want.

Not sure if that answers your question? I think your concept of “anchor points” doesn’t really transfer to Unity. On the other hand, with scripting, everything is possible.

oh ok so you don’t need anchor points to make a game look the same on different screen seizes ?

I actually just found out that unity had anchor points, thats why I had to ask. You can find anchor points by right clicking on the hierarchy and then going to ui and then image- you will get a white box. Then you can add a sprite to the image. (just found out because of a Video) however I usually just import the image into my assets and then drag it into the Scene. For some reason if you drag an image to a scene directly you don’t get anchor points (at least that I know off) but if you do it the other way you get a canvas and an image that does have anchor points.

Now I am confused as to the purpose of anchor points in unity since it resizes by itself if you drag the image into the scene and why anyone would add an image by adding a ui Image. (Not saying its dumb just really want to know why you would do that- what are the benefits )

What you did was create a UI element. Those do have anchor points, that is correct. But you don’t usually use those for game graphics, which would rather use a SpriteRenderer component on a game object (as one example.)

My advice would be really to let go of the notion of “anchor points”, and only come back to it when you create your UI with uGUI (Unity’s current UI incarnation.) Instead, just use a game object hierarchy for what it is (see my rationale above.)

(Unless you wanted to create a UI instead of in-game content - it isn’t really clear to me at this point.)

1 Like

oh ok Thanks yeah I think the confusion comes from my inexperience so sorry about that. You still helped a lot and made me understand this whole thing better even with the confusion tough so thanks!

Here is a detailed blog posts on how to treat multiple resolution devices. http://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/

However, if you don’t care about pixel-perfectness (most games don’t) AND don’t change your camera’s orthographicSize, what you CAN see on different sized devices mostly the same. The only difference is the sides could be wider or narrower. But vertically it will be the same.

This is because you fixed how much you can see vertically by setting the orthographicSize (default is 5 from center to top, so 10 units in total). The engine then adds or remove horizontal space to maintain the screen’s aspect ratio.

Example.
for 4:3 and orthographicSize of 5, your width is ((5*2)/3)4 = 13.33
for 16:9 and orthographicSize of 5, your width is ((5
2)/9)*16 = 17.77

In both cases vertically, you have 10 units. So just account for the changing sides and you are good to go.

3 Likes

Thanks!