Unity not allowing me to use Screen.safeArea

I am trying to adjust the UI in my game to properly fit on the screen of an iPhone X.

In my code I am attempting to code the line return Screen.safeArea

However 'safeArea' is highlighted red and when I hover over the error with my cursor a message is displayed saying "error CS0117: 'UnityEngine.Screen' does not contain a definition for 'safeArea'".

I dont understand why I'm getting this error because according to Unity's documentation UnityEngine.Screen does contain a definition for safeArea.

Any inclination or idea as to why I am running into this error?

Also, I am working with Unity 2017.2.0f3

As per comments bellow, code as been asked for.

private Screen ReturnSafeArea(){return Screen.safeArea}

as I tried saying, the code has nothing to do with it. Even in this simplistic instance of the use of Screen.safeArea, safeArea is listed as not a definition of UnityEngine.Screen.

enter image description here

enter image description here

Hovering over safeArea displays the following message

"'Screen' does not contain a definition for 'safeArea"

2 answers

  • answered 2018-03-13 20:56 Draco18s

    Screen.screenArea is of type Rect and your method is defined as returning a value of type Screen


    One way to correct this:

    private Rect ReturnSafeArea(){
        return Screen.safeArea;

    Additionally, the field was added in 2017.2.0p1 (Nov 6) and you're on 2017.2.0f3 (Oct 3). Link is for 0.2, but 0.f3 does not have its own page, so likely was made either the same day or very shortly after.

  • answered 2018-03-13 20:56 raybarrera

    I believe Screen.safeArea was added in a minor release of 2017.2, so 2017.2.0f3 would not have it. Try your code in 2017.2.1 and newer to confirm. It's too bad the documentation doesn't specify that.