How to get 2d camera width & height?

Hi, I’m trying to learn Unity & also train on C#, so I decided to start simple by making Pong, but I don’t understand the 2d camera:

  • How can I get the height & width of the camera view? (the white rectangle)

I expected to find some numbers like 1280x1024 or similar, but the only slightly relevant number I have found is 5 with the label: Size, which seams to be the radius from center to top & bottom but not sideways

The goal is to program the ball to bounce on the inside of the camera-border so I don’t have to “cheat” with placing objects with collision boxes as borders & it would also allow to automatically adjust itself to whatever camera/screen size the player is using, but to do that I need to get the size of the camera view.


Well, thanks for absolutely nothing!

For future readers, here are some relevant information:

  • The thing you are looking for is NOT the Camera, it’s called the Frustum (that is the “view-port cone” in front of the camera)
  • Here are a good video about the relations between the frustum size & sprite sizes: link text
  • In this Wiki article you will find the math for calculate the size of the frustum cone at a specific depth: link text
  • If all else fails, then try browsing the Unity Asset Store, here is a link to free cameras: link text

Hope you will have better luck than I had with this post!

Why is no one answering?

Surely most people on here must know the answer to this?