I am trying to make a 2D game where a ball bounces off the edge of the camera in Unity. Now, if I understand it right, Unity is more, you make and environment, and then align the camera, not make the environment to fit the camera, right?
I could get the position of the ball and then see if its greater than a certain value and then apply a force, which is what I was doing, but with different devices, the screen ratio changes, so that doesn't work. Is there a way to detect if it just hits the edge of the camera/view or some percentage unit that I could use? With this game, the camera moves up and down with the ball so only the left and right sides would need to be "bouncy".
When I looked this up, some people suggested using an a barrier that was set the the edge the of the camera. With all the scaling and ratio aspect changes, I think it would be easier just to detect the edge, whether using some method to get the screen width in pixels, or some other way.
Screen.width
andScreen.height
– Savaria