- Home /
This question was
closed Oct 07, 2017 at 09:44 AM by
unity_G2yrNlWYdpJKuw.
Question by
unity_G2yrNlWYdpJKuw · Oct 06, 2017 at 03:58 PM ·
unity 5playerresolutionplayer movementboundary
Player boundaries based on screen resolution
Hello, so I have a 2D mobile game. I have a player that you move by dragging it, but the problem right now is that you can drag it out of the screen. Now my problem is how do I set up player boundaries for multiple screen resolutions? If anyone knows how to do that it will be great, thank you!
Comment
Answer by ArmanDoesStuff · Oct 06, 2017 at 04:11 PM
You can get the camera dimensions at runtime and use that. See here
If using a perspective camera, you can get the pixel Width/Height and use ScreenToWorldPoint
Hey, the problem is that I am not using my main camera but I am using canvas, so If I use that it wont work.