Click here to Skip to main content
15,796,299 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
 I want to consider the edges/borders of the screens and place the gameObject accordingly with sufficient padding across those edges/borders of screens. Also I have to keep the scale(x & y) equal. 
I have to prevent it from being bigger or smaller and getting out of the view or overlapping with other objects in the game scene. BTW it's a 2D game.

What I have tried:

I have tried Camera.main.ScreenToWorldPoint but don't know how to guide it to get what I want. And I don't think it would be sufficient to do that.
Updated 7-May-23 23:27pm
Dr. Punch 5-Sep-23 12:36pm    
Did you found a solution for your problem?
I have the same problem, I need to adjust my prefabs(gameObjects) to scale with the resolution of the device the game has been used on. Otherwise the mechanics of the gameplay change.
I know that big game studios are using assets with different dimensions for different resolutions.
But as a solo game dev that's a lot of work and very time consuming.

1 solution

Share this answer
arpitsrivstva 8-May-23 4:09am    
NO! The video is for canvas/UI elements like all the other youtube videos. But I need anything to scale and set the padding boundaries of my element according to different screen sizes outside the canvas - Not UI objects.
Graeme_Grant 8-May-23 4:40am    
The unity help room would be a better place to ask this question. Here is the link: All Posts in Help Room - Unity Answers[^] or their Forums: Unity Forums[^]

Both of these official links were in the Google Search link that I provided above. There are many more options / solutions, you just need to look.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900