- Home /
Translate Object based on Screen Resolution
Hii everyone..
I am having left border on lest side of the screen.
In start that border is out of the scene means I have set the position of that border such that it is not visible.
But after some conditions true, i want that border to be visible so that i am translating that border to the position so that it will be visible.
But bcz of the different screen resolution it is not shown same in all devices. Some portion of that border cuts in some resolution.
what should i do so that it is shown same in all device ?
Thanks..
so your problem comes down to finding the position that is somewhat offset from the position of your left border of the screen (camera). You can find that position by casting a ray on the position of (0, pixelHight/2) using a method on your camera called ScreenToWorldPoint. Check out the docs for Camera.ScreenToWorldPoint.
Once you get the far left position in the world coordinate system, set your initial border position to be more to the left than position of the border to keep it from showing on the screen.
Answer by kwmx · Dec 28, 2014 at 08:00 PM
Try taking a look at
https://www.assetstore.unity3d.com/en/#!/content/22132
You can see the source code and find out a way to do what you intend to do. It will also help you fit everything you want in the screen. aaaaaand its free