Basically, I am from a Swift SpriteKit background where UIScreen.mainScreen().bounds is a CGRect which represents the screen and can be manipulated in various ways like getting the middle of the screen by using

var screenCenter = CGPointMake(UIScreen.mainScreen().bounds.width/2, UIScreen.mainScreen().bounds.height/2)

What is an equivalent of UIScreen.mainScreen().bounds in Unity (C# Scripting) that can manipulated to get various positions in a similar manner?


1 Answer 1


Sounds like you want the Screen class:

var screenCenter = new Vector2(
                       ) * 0.5f;

Note that this will give you the pixel coordinates of the center of the screen, in screenspace. To translate this into a position within the world coordinate system, you'll want to use something like Camera.ScreenToWorldPoint.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .