#Easy way to scale non-UI elements with screen size?

1 messages · Page 1 of 1 (latest)

wise wigeon
#

I am developing a mobile game where I have to work with multiple screen sizes. For UI, it is easy because I can just use the Canvas Scaler component.

Is there an easy way to do this for non-UI elements? Maybe some kind of script to set the position on the new screen size relative to the position on a reference screen size? Or can I set a GameObject's position for different screen sizes manually in any way?

Any help is appreciated 🙂

empty lichen
#

I mean. U dont have to do anything. its how it works. Unity doing it by it self.

wise wigeon
empty lichen
#

exactly what i mean

#

3d objects relatives positions, sizes and scales on a scene dont changes if there is more or less pixels on the screen (resolutions)

#

only if there ratio of a screen size changes like was 16:9 and now its 18:9 - then it just gonna see more or less of scene

#

but still nothing changes

#

not positions or sizes or any other relatives

#

could you mb give more info then? mb some screenshots? or anything

wise wigeon
#

And I want to know how I would approach this problem because I don't really know how to :/

#

Please ping me if you reply, so I can answer quickly

empty lichen
wise wigeon
#

I guess they don't technically resize, they just reposition themselves.

#

But if I were to put a triangle like so:

#

It doesn't resize with the screen size because it's not UI

#

But I want it's size to be relative to the screen size

#

I am sorry, I can't explain it very well, but do you understand my issue now @empty lichen ?

empty lichen
#

i see

empty lichen
#

but if this objects should use physics and not just visuals i wouldn't recommend that cause u literally changing the object. so every thing that gonna interract with it gonna be different as well. (literally different game-play results on different screen's )

wise wigeon
#

The final objects will just use a constant velocity. Is velocity affected by size?

empty lichen
#

depends on u'r code (realisation). on default - no.

wise wigeon
#

Allright, I will try to realize your solution. I might have an additional question later if you don't mind

empty lichen
#

sure

#

i will be able to help )

empty lichen
#

@wise wigeon i just remmembered one thing. u can add 3d objects to u'r canvas actually. i dont know if the resizing will work the same in this way. but u can also just try it and see.