❔ Prefab different sizes on 2 different monitors.

I'm working across 2 different computers with 2 different monitor resolutions. I have a prefab which is the right size on one monitor, but too small on the other. How can I get them to be the same size on both. I notice the game over text has a canvas scaler which has a 'scale with screen'option. Do I need to incorporate something like that? Thanks
11 Replies
Buddy
Buddy2y ago
You have to zoom in based on the window ratio, yes pretty much a scaling script.
coffeekeepsmegoing
is this just a developing the game issue,? what about when (in theory) people playing the game at home on there comps?
Cattywampus
Cattywampus2y ago
there's scalemode under canvasscaler set it to either follow your screen width or height also you should anchor things so you're ui would be consistent on multiple resolutions
Buddy
Buddy2y ago
I don't think this is regarding UI But world gameobjects
Cattywampus
Cattywampus2y ago
he mentioned something about canvas scaler, so I assume it's UI stuff
coffeekeepsmegoing
It's not UI, I was using it as an example. It is for a prefab, so don't seem to have access to canvasScaler
Cattywampus
Cattywampus2y ago
well then that's super weird proly make sure you have them setup properly I guess it's 2d or 3d game?
coffeekeepsmegoing
2d on the prefab, what setting would affect the scale to make it universl?
Cattywampus
Cattywampus2y ago
you can do screen-to-world conversion
Vector2 topRight = new Vector2(1, 1);
Vector2 val = Camera.main.ViewportToWorldPoint(topRight);
Vector2 topRight = new Vector2(1, 1);
Vector2 val = Camera.main.ViewportToWorldPoint(topRight);
then multiply it by 2 to get the height and do the same with the width that's how we used to do it in the old Unity versions, I'd not be surprised if this already supported as part of the Sprite renderer component you should check if there's a ready made component for that in the component tab
Buddy
Buddy2y ago
I believe if Camera is set to orthographic, the size should be equal by all resolutions. If it isn't set to orthographic you have to manually scale it.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server