#Centering mesh in center of screens on different mobile devices?
1 messages · Page 1 of 1 (latest)
Shaders could do it, but it sounds like it'd be more convenient to do it with code
@granite lantern : I've been doing a bit of reading. Do you happen to know the specifics of how I should approach this? This guy provided what seems like a simple script: https://discussions.unity.com/t/dynamic-loaded-object-fit-to-screen-size/594742/6
Looks like people use camera controllers pretty commonly. I found this one : https://assetstore.unity.com/packages/tools/camera/camera-system-gaskellgames-248116
I also found out about Cinemachine/Timeline.
It gets a little much
I'm no longer sure what problem is being solved
I just want to have a model centered on all mobile devices
Scaling an object to screen is different from centering
I thought everything I provided was camera based
Unity's cameras already adapt to any screen resolution, as well as aspect ratio
My apologizes, I'm very new. So, if I use position X=0, Y=0, then it will be in thr same place on all screens. Is that what you are saying?
Relative to camera, yes
You understand my goal correct? It seems that there is no issue? Its all relative?
X=0, y=0 will always start at the center of everyones screen
Yes, if the camera is facing that point
Whether your user has a 1080p screen or 8k screen it'll look the same, only fidelity changes
If aspect ratio changes, then the horizontal screen proportions will change
But I think all mobile devices are 9:16
You can use the Game window's dropdown to preview any type of screen
Yeah. I've been using the one for my andriod. I think there are some minor differences but not too much.
I will make sure there is buffers to allow for things to get cut off.
Ok. Thank you for explaining. I will test and learn more. I just wanted to make sure I wasn't making any fundemental mistakes
If the resolutions and aspect ratios in the dropdown match real screen dimensions, they will visualize any differences
That makes sense.
I think it only would make a difference if your game needs to look the same or similar in landscape and portrait modes
But even for PC I believe non 16:9 aspect ratios are vanishingly uncommon
That isn't required. I was thinking that I would have certain scenes forced into landscape but none would have to support both
Not totally sure but I think in that case you have the option to rotate the camera, or to resize its size / fov
Camera size and fov are in vertical units
I'll cross that bridge when I get to it. Enough directly in front me.