- Home /
Move camera when reach edge of screen in C#
I am trying to make the camera move when it reaches the edge of the screen in C#
I am trying to make the camera move when it reaches the edge of the screen in C#
How can the camera reach the edge of the screen if it only moves once it reaches the edge of the screen?!?
I mean when the player reaches the end of the camera the camera will move to the right until the player is in it beginning again
A-ha! That's more clear. Use Camera.WorldToViewportPoint with the player's x position. If it's less or equal 0, the camera has to move left. If it's higher or equal to 1, the camera has to move right.
Your answer
![](https://koobas.hobune.stream/wayback/20220612035131im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to move a camera only using the arrow keys? 7 Answers
New to unity -1 Answers
How do I tell a button to move my camera!? 1 Answer
How to stop the player rotation after i stop the camera? 1 Answer
ROBLOX Like Camera Script 2 Answers